Dear experts,
when a frame contains a GLCanvas, the FileDialog is broken somehow. I don't
know how these two are related, but below is a minimal example. When I open
the FileDialog via the menu and close it again, I get the following message
on my terminal twice:
(python2:19983): GLib-GObject-CRITICAL **: g_object_ref: assertion
`object->ref_count > 0' failed
When I remove the glcanvas.GLCanvas(self) from the code, the FileDialog does
not raise an error message any more. In a more complicated GUI that I am
writing, I sometimes also get a segmentation fault when I close the FileDialog.
My operating system: Arch Linux
wxPython version: 2.8.12.1
Can you reproduce this? Any idea what is wrong here?
Regards,
Daniel
(Sorry for posting the code inline. The gmane interface doesn't seem to
support attachments.)
···
----------------------------------------------------------------------
import wx
import wx.glcanvas as glcanvas
import wx.lib.inspection
class MainFrame(wx.Frame):
def __init__(self, parent, **kwargs):
wx.Frame.__init__(self, parent, **kwargs)
self.Canvas = glcanvas.GLCanvas(self)
MenuBar = wx.MenuBar()
FileMenu = wx.Menu()
OpenId = wx.NewId()
FileMenu.Append(OpenId, "&Open File\tCtrl-O")
self.Bind(wx.EVT_MENU, self.OnOpen, id=OpenId)
MenuBar.Append(FileMenu, '&File')
self.SetMenuBar(MenuBar)
self.Show()
def OnOpen(self, event):
FileDialog = wx.FileDialog(self, 'Select file')
FileDialog.ShowModal()
FileDialog.Destroy()
class MyGUI(wx.App):
def OnInit(self):
self.GUIMainFrame = MainFrame(None, title = 'GUI')
return True
app = MyGUI(0)
wx.lib.inspection.InspectionTool().Show()
app.MainLoop()