wxMessageBox shows twice

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
ChopStick
Earned a small fee
Earned a small fee
Posts: 22
Joined: Wed Mar 29, 2017 6:36 am

wxMessageBox shows twice

Post by ChopStick »

Hello guys,
In my c++ code, wxMessageBox opens twice, though, I call it just once:

Code: Select all

void CameraStreamFrame::OnClose(wxCloseEvent& event)
{
    setgetClosing(true, true);				//Closes a thread 
    wxMessageBox("Close", "Goodbye");		//Is called twice
    event.Skip(true);						
}
I don't get this error with Destroy() but windows comes up with another error, which says: assert "m_count > 0" failed in DecRef().
I couldn't figure out, what is wrong with my code.
Probably you can help me
Thanks
ChopStick
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMessageBox shows twice

Post by doublemax »

Any chance that you've connected the event handler twice? E.g. by having two entries in the event table or one entry plus a Bind() or Connect()?
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMessageBox shows twice

Post by ONEEYEMAN »

Hi,
The easiest way is to probably set a breakpoint in this handler and see where the second time it is hit.
You did compile your code in debug mode, correct?

Thank you.
Post Reply