GTK assertion

I'm probably just overlooking something obvious, but why does the code
below generate the following message?

Gtk-CRITICAL **: file gtkwidget.c: line 1388 (gtk_widget_destroy): assertion
`GTK_IS_WIDGET (widget)' failed.

from wxPython.wx import *

class MainWindow(wxFrame):
    def __init__(self,parent):
        wxFrame.__init__(self,parent,-1,"test",size=(640,480))

        self.mb=wxMenuBar()

        # create two menus, the first one with a submenu
        menu1=wxMenu()
        menu2=wxMenu()
        submenu1=wxMenu()
        submenu1.Append(1,"submenu1")
        menu1.AppendMenu(2,"submenu",submenu1)
        
        self.mb.Append(menu1,"menu1")
        self.mb.Append(menu2,"menu2")

        self.SetMenuBar(self.mb)

        # remove the first menu
        m=self.GetMenuBar().Remove(0)
        # the above line gives a gtk assertion, why?
        # it works if you remove the other menu (which doesn't have a submenu)

        # insert the same menu again
        self.mb.Insert(0,m,"menu1")
        
class MyApp(wxApp):
    def OnInit(self):
        frame=MainWindow(None)
        frame.Show(true)
        return true
    
app=MyApp(0)
app.MainLoop()

This is under linux, wxpython 2.4.0.1, gtk 1.2.10, python 2.2

···

--
  Pierre Hjälm, Systems Administrator
  Department of Information Science, Uppsala University, Sweden
  email:pierre.hjalm@dis.uu.se phone:+46-(0)18-4711044 fax:+46-(0)18-554422

Pierre Hjälm wrote:

I'm probably just overlooking something obvious, but why does the code
below generate the following message?

Gtk-CRITICAL **: file gtkwidget.c: line 1388 (gtk_widget_destroy): assertion
`GTK_IS_WIDGET (widget)' failed.

Please enter a bug report (with "wxGTK" category) about this.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!