]> spindle.queued.net Git - midori/commitdiff
Connect callbacks for gtk_widget_destroy where signature differs
authorEnrico Tröger <enrico.troeger@uvena.de>
Tue, 29 Dec 2009 22:49:10 +0000 (23:49 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 29 Dec 2009 22:49:10 +0000 (23:49 +0100)
Apparently dependent on architecture and compiler, mismatching
callback signatures can cause segmentation faults.

extensions/adblock.c
extensions/feed-panel/main.c
extensions/shortcuts.c
midori/midori-browser.c
midori/midori-searchaction.c
midori/midori-view.c
midori/sokoke.c

index 6cb2be3756a6a9b8fe6f7623e6814155bc3ddd28..289f714f3cac6498175b961d8bbf1ef0395db21f 100644 (file)
@@ -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)))
index f2ddeb62437fc4a3639abbae5837cc557c5a5bf1..499a4e09da17a459d404b01303c5acf634c1f214 100644 (file)
@@ -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
index 1c25508e1ca424a8eae66693fe80a7babfb59483..3ff55788202562be7c8b9dfe08066dad459ffba0 100644 (file)
@@ -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),
index 1fb256f39f9325305c4f99962fd853e77fcaa944..77c42c673723b5c13cc456e27724cfff963515eb 100644 (file)
@@ -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
index b469ce54ba2cbfc68ee1a1da76ce4f2346a052b8..98ac92cce312a244bd51fbf73a95bc963ef24de1 100644 (file)
@@ -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 (
index bb232e0cf15289315156191997dd83c68af414e2..0202206e5a039ded08607a2762200c775a65ebc9 100644 (file)
@@ -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
index d46de8046f8b728dbcdd97d69769a5ee8d2f68b2..d0f6152948aabee25446c877c0c4ab452f35dd06 100644 (file)
@@ -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);
 }