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
This commit is contained in:
@@ -971,7 +971,8 @@ void wxMenu::Init()
|
|||||||
m_menu = gtk_menu_new();
|
m_menu = gtk_menu_new();
|
||||||
// NB: keep reference to the menu so that it is not destroyed behind
|
// 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:
|
// 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;
|
m_owner = (GtkWidget*) NULL;
|
||||||
|
|
||||||
@@ -1000,7 +1001,7 @@ wxMenu::~wxMenu()
|
|||||||
if ( GTK_IS_WIDGET( m_menu ))
|
if ( GTK_IS_WIDGET( m_menu ))
|
||||||
{
|
{
|
||||||
// see wxMenu::Init
|
// see wxMenu::Init
|
||||||
gtk_widget_unref( m_menu );
|
g_object_unref(m_menu);
|
||||||
g_object_unref( m_accel );
|
g_object_unref( m_accel );
|
||||||
|
|
||||||
// if the menu is inserted in another menu at this time, there was
|
// if the menu is inserted in another menu at this time, there was
|
||||||
|
Reference in New Issue
Block a user