using skinframe in DLL, crash when exits |
Post Reply |
Author | |
lyonwhl
Newbie Joined: 14 August 2008 Location: China Status: Offline Points: 7 |
Post Options
Thanks(0)
Posted: 19 November 2008 at 8:28pm |
Hi,
I want to use skinframe to decorate my own dialog in regular MFC DLL. Everything is ok in runtime . But when the main application exits, it crashes. The error happends in the file "afxwinl.inl" ,line 37 "{ return afxAmbientActCtx; }", and the tip is "0x0000005 clashing happens when reading 0x1003c770".
On the other hand, if the main application call the own dialog directly, there is no problem.
By the way, if the main application use my own dialog firstly and DLL use it later, no error happens.
I appreciate any help.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Remove all objects in ExitInstance of your dll:
XTPSkinManager()->LoadSkin(NULL, NULL);
XTPSkinManager()->RemoveAll();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I'm encountering a similar problem, but with no skinning at all. Is there a similar principle for commandbars and menus?
We get the crash after this code has been executed:
CXTPCommandBars* pCommandBars = (CXTPCommandBars*)CXTPCommandBars::CreateObject();
if (pCommandBars)
{
pCommandBars->SetSite(this);
CXTPPopupBar *pPopupBar = CXTPPopupBar::CreatePopupBar(pCommandBars);
CXTPControlButton *pButton = (CXTPControlButton*)pPopupBar->GetControls()->Add(xtpControlButton, 1000);
pButton->SetCaption("Test");
pCommandBars->TrackPopupMenu(pPopupBar, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, point.x, point.y, this);
pPopupBar->InternalRelease();
pCommandBars->InternalRelease();
}
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Looks like right core. What lines give crush ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
The crash happens after the OCX has unloaded. It's so weird!
I've tried to make a sample project where this would happen, but it doesn't. Here's the structure:
EXE initializes OCX. Then a member function is called where a dialog is shown (the OCX is dependent on ToolkitPro). In this dialog we run the code above, displaying a menu. As soon as this menu has been shown (nothing more), we get a crash when we press "Cancel" in this dialog (effectively exiting the application).
It's crazy. But if we use a normal menu, the problem goes away.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Such things need to debug :( Please try reproduce it again .
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
I had this exact same problem. The problem is that CJ is grabbing and storing the module state data pointer and accessing it after your ocx (dll) unloads. I debugged this some time ago (june last year) and I put this comment in my code:
CodeJock is loading an image file. When that happens CJ creates some CCmdTarget object // and that object grabs and stores the module state data pointer. Later when unloading, the CJ object accesses it. The issue // is that the list control DLL can unload before the CJ (toolkitpro) DLL.It appears to me that CJ thinks it is grabbing its own module state data. There is no reason I know of for CJ to store your (or my) OCX module state data. To avoid the crash in my app, I had to swap out my OCX module state data with that of my application since it is one of the last modules to unload. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |