From 56984ab2773b6ebd6bf32792a8a844fafa2ea970 Mon Sep 17 00:00:00 2001 From: Alex Larsson Date: Tue, 5 Jun 2001 21:48:24 +0000 Subject: [PATCH] Don't crash when the properties window is destroyed. 2001-06-05 Alex Larsson * tests/testgtk.c (destroy_properties): Don't crash when the properties window is destroyed. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): Use with_mnemonics to handle the case of stock items with underscores in them. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtkimagemenuitem.c | 2 +- tests/testgtk.c | 28 +++++++++++++++++++--------- 9 files changed, 83 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1244218b5b..dcc9e957ca 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-06-05 Alex Larsson + + * tests/testgtk.c (destroy_properties): + Don't crash when the properties window is destroyed. + + * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock): + Use with_mnemonics to handle the case of stock items with + underscores in them. + 2001-06-05 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_order): rename from diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index 68c020407f..cd74909a73 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -399,7 +399,7 @@ gtk_image_menu_item_new_from_stock (const gchar *stock_id, if (gtk_stock_lookup (stock_id, &stock_item)) { - item = gtk_image_menu_item_new_with_label (stock_item.label); + item = gtk_image_menu_item_new_with_mnemonic (stock_item.label); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); diff --git a/tests/testgtk.c b/tests/testgtk.c index 5f3611f1ac..e6042b54c3 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -9265,15 +9265,26 @@ struct PropertiesData { }; static void -destroy_properties (GtkWidget *widget, +destroy_properties (GtkWidget *widget, struct PropertiesData *data) { - *data->window = NULL; + if (data->window) + { + *data->window = NULL; + data->window = NULL; + } if (data->cursor) - gdk_cursor_destroy (data->cursor); - - gtk_signal_disconnect (widget, data->handler); + { + gdk_cursor_destroy (data->cursor); + data->cursor = NULL; + } + + if (data->handler) + { + gtk_signal_disconnect (widget, data->handler); + data->handler = 0; + } g_free (data); } @@ -9345,9 +9356,9 @@ create_properties (void) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - data->handler = gtk_signal_connect_object (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC(destroy_properties), - data); + data->handler = gtk_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC(destroy_properties), + data); gtk_window_set_title (GTK_WINDOW (window), "test properties"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -10761,6 +10772,5 @@ main (int argc, char *argv[]) g_main_iteration (FALSE); #endif } - return 0; }