From 9183f8e16dbcd5b9efe610178be78fed1bd2acb0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Tue, 29 Dec 2009 23:49:10 +0100 Subject: [PATCH] Connect callbacks for gtk_widget_destroy where signature differs Apparently dependent on architecture and compiler, mismatching callback signatures can cause segmentation faults. --- extensions/adblock.c | 10 +++++++++- extensions/feed-panel/main.c | 12 ++++++++++-- extensions/shortcuts.c | 10 +++++++++- midori/midori-browser.c | 12 ++++++++++-- midori/midori-searchaction.c | 10 +++++++++- midori/midori-view.c | 10 +++++++++- midori/sokoke.c | 12 ++++++++++-- 7 files changed, 66 insertions(+), 10 deletions(-) diff --git a/extensions/adblock.c b/extensions/adblock.c index 6cb2be37..289f714f 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -314,6 +314,14 @@ adblock_activate_link_cb (GtkWidget* label, } #endif +static void +adblock_preferences_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + static GtkWidget* adblock_get_preferences_dialog (MidoriExtension* extension) { @@ -361,7 +369,7 @@ adblock_get_preferences_dialog (MidoriExtension* extension) sokoke_widget_get_text_size (dialog, "M", &width, &height); gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, -1); g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + G_CALLBACK (adblock_preferences_response_cb), NULL); /* TODO: We need mnemonics */ if ((xfce_heading = sokoke_xfce_header_new ( gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title))) diff --git a/extensions/feed-panel/main.c b/extensions/feed-panel/main.c index f2ddeb62..499a4e09 100644 --- a/extensions/feed-panel/main.c +++ b/extensions/feed-panel/main.c @@ -105,6 +105,14 @@ feed_deactivate_cb (MidoriExtension* extension, } } +static void +feed_dialog_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + static KatzeArray* feed_add_item (KatzeArray* feeds, const gchar* uri) @@ -126,8 +134,8 @@ feed_add_item (KatzeArray* feeds, _("Feed '%s' already exists"), uri); gtk_window_set_title (GTK_WINDOW (dialog), EXTENSION_NAME); gtk_widget_show (dialog); - g_signal_connect_swapped (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (feed_dialog_response_cb), NULL); } else diff --git a/extensions/shortcuts.c b/extensions/shortcuts.c index 1c25508e..3ff55788 100644 --- a/extensions/shortcuts.c +++ b/extensions/shortcuts.c @@ -132,6 +132,14 @@ shortcuts_hotkey_for_action (GtkAction* action, return FALSE; } +static void +shortcuts_preferences_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + static GtkWidget* shortcuts_get_preferences_dialog (MidoriExtension* extension) { @@ -172,7 +180,7 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension) sokoke_widget_get_text_size (dialog, "M", &width, &height); gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, height * 24); g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + G_CALLBACK (shortcuts_preferences_response_cb), NULL); if ((xfce_heading = sokoke_xfce_header_new ( gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title))) gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 1fb256f3..77c42c67 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2301,6 +2301,14 @@ _action_add_news_feed_activate (GtkAction* action, midori_browser_subscribe_to_news_feed (browser, uri); } +static void +_action_compact_add_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + static void _action_compact_add_activate (GtkAction* action, MidoriBrowser* browser) @@ -2336,8 +2344,8 @@ _action_compact_add_activate (GtkAction* action, } gtk_widget_show (dialog); - g_signal_connect_swapped (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (_action_compact_add_response_cb), NULL); } static void diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index b469ce54..98ac92cc 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -1189,6 +1189,14 @@ midori_search_action_treeview_destroy_cb (GtkWidget* treeview, } } +static void +midori_search_action_dialog_respnse_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + /** * midori_search_action_get_dialog: * @search_action: a #MidoriSearchAction @@ -1251,7 +1259,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) sokoke_widget_get_text_size (dialog, "M", &width, &height); gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, -1); g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + G_CALLBACK (midori_search_action_dialog_respnse_cb), NULL); /* TODO: Do we want tooltips for explainations or can we omit that? We need mnemonics */ if ((xfce_heading = sokoke_xfce_header_new ( diff --git a/midori/midori-view.c b/midori/midori-view.c index bb232e0c..0202206e 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -4140,6 +4140,14 @@ midori_view_print_custom_widget_apply_cb (GtkPrintOperation* operation, } #endif +static void +midori_view_print_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + /** * midori_view_print * @view: a #MidoriView @@ -4183,7 +4191,7 @@ midori_view_print (MidoriView* view) g_error_free (error); g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), NULL); + G_CALLBACK (midori_view_print_response_cb), NULL); gtk_widget_show (dialog); } #else diff --git a/midori/sokoke.c b/midori/sokoke.c index d46de804..d0f61529 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -104,6 +104,14 @@ sokoke_js_script_eval (JSContextRef js_context, return value; } +static void +sokoke_message_dialog_response_cb (GtkWidget* dialog, + gint response, + gpointer data) +{ + gtk_widget_destroy (dialog); +} + void sokoke_message_dialog (GtkMessageType message_type, const gchar* short_message, @@ -119,8 +127,8 @@ sokoke_message_dialog (GtkMessageType message_type, "%s", short_message); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", detailed_message); - g_signal_connect_swapped (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (sokoke_message_dialog_response_cb), NULL); gtk_widget_show (dialog); } -- 2.39.5