From d3c333373548166e1024420ddbbf802a998985fa Mon Sep 17 00:00:00 2001 From: scott Date: Thu, 5 Feb 1998 04:10:43 +0000 Subject: [PATCH] Menufactory now refs&sinks its children. --sg --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkmenufactory.c | 18 +++++++++++++++--- 8 files changed, 50 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cb37785d77..a03a2ab15c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Wed Feb 4 23:05:28 1998 Scott Goehring + + * gtk/gtkmenufactory.c: menufactories now ref&sink the menus they + create + Thu Feb 5 02:13:08 1998 Tim Janik * gtk/gtklist.h: diff --git a/gtk/gtkmenufactory.c b/gtk/gtkmenufactory.c index eef5c8a373..02c748c84e 100644 --- a/gtk/gtkmenufactory.c +++ b/gtk/gtkmenufactory.c @@ -88,6 +88,9 @@ gtk_menu_factory_destroy (GtkMenuFactory *factory) if (factory->table) gtk_accelerator_table_unref (factory->table); + + if (factory->widget) + gtk_widget_unref (factory->widget); } void @@ -102,7 +105,11 @@ gtk_menu_factory_add_entries (GtkMenuFactory *factory, g_return_if_fail (nentries > 0); if (!factory->widget) - factory->widget = gtk_menu_factory_make_widget (factory); + { + factory->widget = gtk_menu_factory_make_widget (factory); + gtk_widget_ref (factory->widget); + gtk_object_sink (GTK_OBJECT (factory->widget)); + } for (i = 0; i < nentries; i++) gtk_menu_factory_create (factory, &entries[i], factory->widget, entries[i].path); @@ -272,8 +279,13 @@ gtk_menu_factory_create (GtkMenuFactory *factory, if (subfactory->path && (strcmp (subfactory->path, tmp_path) == 0)) { - if (!subfactory->widget) - subfactory->widget = gtk_menu_factory_make_widget (subfactory); + if (!subfactory->widget) + { + subfactory->widget = gtk_menu_factory_make_widget (subfactory); + gtk_widget_ref (subfactory->widget); + gtk_object_sink (GTK_OBJECT (subfactory->widget)); + } + gtk_menu_factory_create (subfactory, entry, subfactory->widget, p + 1); return; }