Hi
I am facing a crash only in 2k with the following scenario . In XP and 98 this problem is not observed
In my scenario I have X.exe, Y.dll. Y.dll exports a function (say Z) which has DoModal() of a dialog called. X.exe on click of a button starts a thread and in that thread calls the Z method which shows up a dialog. The problem happens when the button is clicked thrice or more than thrice. The three dialogs are lauched in three threads and are shown. But if I try to move the dialogs, After some time a crash is seen, whcih occurs in a method of MFC42.dll.

More information about the scenario is X.exe links Y.dll statically. X links MFC as a shared dll, where as Y.dll links the same as a static dll. I suspected module state change when the the control is going out of thread boundary to Dll. But the exported function already has AFX_MANAGE_STATE(AfxGetStaticModuleState( )); as te first statement.

Please let me know if any body faced the same problem before and point me towards the solution.
Thanks
Sre

Re: Dll exporting a function that creates MFC dialog is causing crash in MT. by William

William
Mon Mar 01 01:29:11 CST 2004

"Sreekanth" <anonymous@discussions.microsoft.com> wrote in message
news:12662041-249B-4FBD-8520-8A73BC1203C8@microsoft.com...
> Please let me know if any body faced the same
> problem before and point me towards the solution.

My guess is that the problem, whatever it is, has more to do with threading
issues than platform and that the problem is more likely to manifest itself
on 2K due to other variables, e.g. speed of the processor.

Regards,
Will



RE: Dll exporting a function that creates MFC dialog is causing crash in MT. by anonymous

anonymous
Mon Mar 01 04:26:05 CST 2004

May be WILL.
Here is some more info about the problem. When I simulated the problem with Debug binaries, It caused a debug assertion failure whose source is as below

File name: Wincore.cp
Method : AfxWndPro
Lines

CWnd* pWnd = CWnd::FromHandlePermanent(hWnd)
ASSERT(pWnd != NULL); //Here its failing.

Here FromHandlePermanent is returning NULL. What can be the reasons for its failure and how that is related to my scenario
Please suggest
Thanks
Sreekanth





Re: Dll exporting a function that creates MFC dialog is causing crash in MT. by William

William
Mon Mar 01 11:56:13 CST 2004

"Sreekanth" <anonymous@discussions.microsoft.com> wrote in message
news:569A9B22-2618-41D0-A2F4-FAB31036DE7D@microsoft.com...
> Here is some more info about the problem. When I simulated
> the problem with Debug binaries, It caused a debug assertion
> failure whose source is as below.
>
> File name: Wincore.cpp
> Method : AfxWndProc
> Lines:
>
> CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
> ASSERT(pWnd != NULL); //Here its failing.
>
> Here FromHandlePermanent is returning NULL. What can be the reasons for
its failure and how that is related to my scenario?

I'm neither expert not fan of MFC so I won't venture a guess. I remain
skeptical that this is an issue related to the difference between platforms
but rather is an ordinary bug which you will have to track down.

Regards,
Will