![]() |
Urgent: Crash after winmain exits! |
Post Reply ![]() |
Author | |
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() Posted: 31 October 2008 at 11:05am |
We have a dialog that calls a function inside our OCX, showing a dialog. Inside this dialog I right-click to show a menu, and then dismiss the popup. After that, we exit our application (WM_COMMAND+IDCANCEL). When winmain exits, we get a crash at some AfxGetAmbientActCtx() call:
> mfc90d.dll!AfxGetAmbientActCtx() Line 37 + 0xa bytes C++
mfc90d.dll!AFX_MAINTAIN_STATE2::AFX_MAINTAIN_STATE2(AFX_MODULE_STATE * pNewState=0x07b1e4c8) Line 86 + 0x5 bytes C++ mfc90d.dll!CCmdTarget::InternalRelease() Line 173 + 0x14 bytes C++ ToolkitPro1201vc90D.dll!00c509c2() This is how the menu is shown (inside the dialog):
CXTPCommandBars* pCommandBars = (CXTPCommandBars*)CXTPCommandBars::CreateObject();
if (pCommandBars) { pCommandBars->SetSite(this); CXTPPopupBar *pPopupBar = CXTPPopupBar::CreatePopupBar(pCommandBars); pPopupBar->LoadMenu(&RButtonMenu); pCommandBars->TrackPopupMenu(pPopupBar, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, WindowPoint.x, WindowPoint.y, this);
pCommandBars->InternalRelease(); pPopupBar->InternalRelease(); } |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
Commenting the call to TrackPopupMenu removes the problem. Hmmm?! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Yes - inside ActiveX you need cleanup some Static objects manually.
call
CXTPPaintManager::Done()
and
XTPImageManager()->RemoveAll() in some ExitInstance.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
Finally tested this code. Thank you, it works! |
|
PokerMemento - http://www.pokermemento.com/
|
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
Is the crash due to CJ objects storing the module state data pointer?
|
|
![]() |
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 |