Application does not stop properly, what could be wrong?

0 views
Skip to first unread message

Daniel

unread,
Nov 20, 2009, 5:36:53 PM11/20/09
to wx-users
In my app I use the following to exit:

void TBClientFrame::OnExitPress(wxCommandEvent& event)
{
Close(true);
}

Now for some reason the program does not fully stop and I have to do a
kill -9 on the process. It seems that this only happens when I open a
dialog box (wxDialog) from the main window of my app. If I don't open
the dialog then all is good and the above code causes the app to
finish properly. Note the dialog is always closed with a call to
EndModal.

What could be happening to cause this problem? I can post more code
if neccessary.

Kenneth Porter

unread,
Nov 20, 2009, 6:20:54 PM11/20/09
to wx-u...@googlegroups.com
--On Friday, November 20, 2009 2:36 PM -0800 Daniel <danw...@gmail.com>
wrote:

> Note the dialog is always closed with a call to
> EndModal.

Is the dialog object itself destroyed?


Daniel

unread,
Nov 20, 2009, 6:59:41 PM11/20/09
to wx-users
> Is the dialog object itself destroyed?

Thanks, it was not being destroyed, that was the problem.

Kenneth Porter

unread,
Nov 20, 2009, 7:06:59 PM11/20/09
to wx-u...@googlegroups.com
--On Friday, November 20, 2009 3:59 PM -0800 Daniel <danw...@gmail.com>
wrote:

>> Is the dialog object itself destroyed?


>
> Thanks, it was not being destroyed, that was the problem.

Whereever possible, I try to use smart pointers to avoid this problem. My
policy is that a naked pointer is a "non-owning" pointer and that code does
not have responsibility for deleting the pointed-at object.

You can use either std::auto_ptr, or one of the many boost smart pointers
for replacing raw pointers.


Reply all
Reply to author
Forward
0 new messages