[gnome-software] Avoid a segfault when removing packages



commit 6f8adeb064c7536273063529972bc26ad5eb7d69
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 2 01:45:02 2013 -0400

    Avoid a segfault when removing packages
    
    GsAppWidget must use g_signal_connect_object to connect to
    app signals, since the app can outlive the widget.

 src/gs-app-widget.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 3950984..1462397 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -186,15 +186,6 @@ gs_app_widget_get_app (GsAppWidget *app_widget)
 
 
 /**
- * gs_app_widget_app_state_changed_cb:
- **/
-static void
-gs_app_widget_app_state_changed_cb (GsApp *app, GsAppWidget *app_widget)
-{
-       gs_app_widget_refresh (app_widget);
-}
-
-/**
  * gs_app_widget_set_app:
  **/
 void
@@ -203,9 +194,9 @@ gs_app_widget_set_app (GsAppWidget *app_widget, GsApp *app)
        g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
        g_return_if_fail (GS_IS_APP (app));
        app_widget->priv->app = g_object_ref (app);
-       g_signal_connect (app_widget->priv->app, "state-changed",
-                         G_CALLBACK (gs_app_widget_app_state_changed_cb),
-                         app_widget);
+       g_signal_connect_object (app_widget->priv->app, "state-changed",
+                                G_CALLBACK (gs_app_widget_refresh),
+                                app_widget, G_CONNECT_SWAPPED);
        gs_app_widget_refresh (app_widget);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]