]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/menu.cpp
Cache HDC used for painting for the entire duration of WM_PAINT processing.
[wxWidgets.git] / src / gtk / menu.cpp
index fe49bc3fa19b55e94752b90b093d54f65ea7ad9f..54856e2c7d39bb846e3068efc6f90b74cc303801 100644 (file)
@@ -63,13 +63,14 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event)
 
 wxMenuBar::~wxMenuBar()
 {
-    if (m_widget)
+    if (m_widget && IsAttached())
     {
         // Work around a probable bug in Ubuntu 12.04 which causes a warning if
         // gtk_widget_destroy() is called on a wxMenuBar attached to a frame
         GtkWidget* widget = m_widget;
         m_focusWidget =
         m_widget = NULL;
+        GTKDisconnect(widget);
         g_object_unref(widget);
     }
 }
@@ -748,7 +749,8 @@ wxMenu::~wxMenu()
     // Destroying a menu generates a "hide" signal even if it's not shown
     // currently, so disconnect it to avoid dummy wxEVT_MENU_CLOSE events
     // generation.
-    g_signal_handlers_disconnect_by_func(m_menu, (gpointer)menu_hide, this);
+    g_signal_handlers_disconnect_matched(m_menu,
+        GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, this);
 
     // see wxMenu::Init
     g_object_unref(m_menu);
@@ -911,6 +913,10 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
         return NULL;
 
     GtkWidget * const mitem = item->GetMenuItem();
+
+    g_signal_handlers_disconnect_matched(mitem,
+        GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, item);
+
 #ifdef __WXGTK3__
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL);
 #else