Skip to content

Commit

Permalink
Merge pull request #2613 from jmoraleda/multiple-bug-fixes-in-pure-py…
Browse files Browse the repository at this point in the history
…thon-aui

Bugfixes in pure python aui where rapid layout changes may trigger calls to destroyed C++ objets.
  • Loading branch information
swt2c authored Sep 23, 2024
2 parents b2733b5 + e4cb183 commit be9e7d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wx/lib/agw/aui/auibook.py
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,8 @@ def GetPointedToTab(self):
:rtype: :class:`wx.Window`.
"""

if not self:
return None # The AuiTabCtrl has already been destroyed
screen_pt = wx.GetMousePosition()
client_pt = self.ScreenToClient(screen_pt)
return self.TabHitTest(client_pt.x, client_pt.y)
Expand Down
4 changes: 4 additions & 0 deletions wx/lib/agw/aui/framemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8435,6 +8435,10 @@ def OnRender(self, event):
not part.sizer_item.IsShown()):
continue

# don't draw items that have a pane whose window has been deleted
if part.pane and not part.pane.window:
continue

ptype = part.type

if ptype in [AuiDockUIPart.typeDockSizer, AuiDockUIPart.typePaneSizer]:
Expand Down

1 comment on commit be9e7d2

@Metallicow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that the comments on these lines are concise and self clear as to why it blows up on close/destroy event. Obviously it happened at least once.

Please sign in to comment.