Print Page | Close Window

PostQuitMessage(0) causes crash

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=14933
Printed Date: 23 December 2024 at 3:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PostQuitMessage(0) causes crash
Posted By: znakeeye
Subject: PostQuitMessage(0) causes crash
Date Posted: 08 August 2009 at 7:55am
XTP 13.1.
 
During startup:
XTPImageManager()->InternalAddRef();
m_pItems->SetImageManager(XTPImageManager());
 
And later:
PostQuitMessage(0);
 
Causing a crash in CCmdTarget::~CCmdTarget() for CXTPImageManager.
 
Any ideas?


-------------
PokerMemento - http://www.pokermemento.com/



Replies:
Posted By: Oleg
Date Posted: 10 August 2009 at 3:20am

Hi,

Please show call stack.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 10 August 2009 at 9:39am
Very easy to reproduce with your SDI-sample:
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    ...
    ...
   
    PostMessage(WM_COMMAND, ID_STYLES_CHANGE);
 
    return 0;
}
 
void CMainFrame::OnEmptyCommand()
{
    PostQuitMessage(0);
}
 
 
Probably not an issue, but still suspect that it crashes like this...


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: Oleg
Date Posted: 12 August 2009 at 3:02am
Hi,
 
I don't think PostQuitMessage is best way to terminate application - destructor of CMainFrame is not called and its reason of issue.   Just close MainWindow instead if you need quit.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 12 August 2009 at 3:14am
I agree, but suppose some badly written code does this. Is it possible to destroy the object somehow? CWinApp::PreTranslateMessage?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: Tomasz
Date Posted: 13 August 2009 at 5:15pm
Still, I don't see any reason why PostQuitMessage would need to create crash with XTP ? Isn't it a bug?

http://blogs.msdn.com/oldnewthing/archive/2005/11/04/489028.aspx - http://blogs.msdn.com/oldnewthing/archive/2005/11/04/489028.aspx


Posted By: znakeeye
Date Posted: 14 August 2009 at 3:30am
Sure it's a bug.

-------------
PokerMemento - http://www.pokermemento.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net