Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - PostQuitMessage(0) causes crash
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PostQuitMessage(0) causes crash

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: PostQuitMessage(0) causes crash
    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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 August 2009 at 3:20am

Hi,

Please show call stack.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
Tomasz View Drop Down
Senior Member
Senior Member


Joined: 05 August 2006
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tomasz Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2009 at 3:30am
Sure it's a bug.
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.