Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wx.aui.AuiNotebook.FindTab fails and causes a crash. #2642

Open
komoto48g opened this issue Nov 12, 2024 · 0 comments
Open

wx.aui.AuiNotebook.FindTab fails and causes a crash. #2642

komoto48g opened this issue Nov 12, 2024 · 0 comments

Comments

@komoto48g
Copy link
Contributor

Operating system: Windows 10
wxPython version & source: 4.2.2 (pypi)
Python version & source: 3.12

Description of the problem:

When FindTab gets objects that are not in the pages, it crashes with a 'Windows fatal exception: access violation'

Code Example (click to expand)
#! python3 -Wd -Xdev -Xtracemalloc
import wx
import wx.aui

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        
        self.nb = wx.aui.AuiNotebook(self)
        
        p1 = wx.Panel(self.nb)
        p2 = wx.Panel(self.nb)
        
        self.nb.AddPage(p1, "Tab 1")
        self.nb.AddPage(p2, "Tab 2")
        
        print(self.nb.FindTab(p1))
        print(self.nb.FindTab(p2))
        print(self.nb.FindTab(self)) # => Windows fatal exception: access violation

app = wx.App()
frm = MyFrame(None)
frm.Show()
app.MainLoop()

Outputs:

(True, <wx._aui.AuiTabCtrl object at 0x0000021F751E8CC0>, 0)
(True, <wx._aui.AuiTabCtrl object at 0x0000021F751E8CC0>, 1)
Windows fatal exception: access violation

Current thread 0x00002fb4 (most recent call first):
  File ".../issue_aui-notebook.py", line 19 in __init__
  File ".../issue_aui-notebook.py", line 22 in <module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant