From 0f35e441b0c0743b22e147f957a4cac537e8f81d Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 24 Jan 2008 17:59:11 +0000 Subject: [PATCH] fix memory leak when wxMenu is used as a popup git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/menu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index c89d45db0f..dba9aea315 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -971,7 +971,8 @@ void wxMenu::Init() m_menu = gtk_menu_new(); // NB: keep reference to the menu so that it is not destroyed behind // our back by GTK+ e.g. when it is removed from menubar: - gtk_widget_ref(m_menu); + g_object_ref(m_menu); + gtk_object_sink(GTK_OBJECT(m_menu)); m_owner = (GtkWidget*) NULL; @@ -1000,7 +1001,7 @@ wxMenu::~wxMenu() if ( GTK_IS_WIDGET( m_menu )) { // see wxMenu::Init - gtk_widget_unref( m_menu ); + g_object_unref(m_menu); g_object_unref( m_accel ); // if the menu is inserted in another menu at this time, there was -- 2.45.2