Re: aui based programm terminates with assertion error

Robin Dunn <[email protected]> Mon, 21 Jan 2019 11:55:35 -0800 (PST)
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
On Monday, January 21, 2019 at 10:06:18 AM UTC-8, [email protected] wrote:
>
> Hi,
> I am rewriting a large application to use wx.aui. It works very well but 
> upon terminating I get an assertion error:
>
>   File "/Users/ck/devel/peak-o-mat/branches/aui/peak_o_mat/mainframe.py", 
> line 254, in start
>     wx.GetApp().MainLoop()
>   File 
> "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wx/core.py"
> , line 2134, in MainLoop
>     rv = wx.PyApp.MainLoop(self)
> wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" 
> failed at /Users/robind/projects/buildbots/macosx-vm6/dist-osx-py37/
> Phoenix/ext/wxWidgets/src/common/wincmn.cpp(478) in ~wxWindowBase(): any 
> pushed event handlers must have been removed
>
>
> This happens on both OSX and MSW but on the latter in addition python 
> crashes.
> python3.7, wxpython-4.0.4
>
> What does that message mean? Have I take care of removing those event 
> handlers by myself? And if yes, how?
>


The assertion happens because the C++ wxAuiManager::SetManagedWindow does 
this:

    m_frame->PushEventHandler(this);

but there is no corresponding PopEventHandler in the AUI code. 

You can probably avoid the assertion by adding a EVT_CLOSE handler for the 
Frame passed to SetManagedWindow that does something like this:

    self.PopEventHandler(True)
    event.Skip()

If something besides a Frame is the managed window then you'll need to 
adapt to that configuration.

--
Robin
 

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.