[empathy] fixed problem with destroyed widget in async call



commit 19d28abca284a7a85a98f8bdd01aeb0ff54860e7
Author: Felix Kaser <f kaser gmx net>
Date:   Tue Dec 1 13:53:24 2009 +0100

    fixed problem with destroyed widget in async call
    
    with all the async calls the widget needed in one of the callbacks was destroyed before the callback was called.

 libempathy-gtk/empathy-account-widget.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 80523f0..30bb552 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -685,6 +685,7 @@ account_widget_account_enabled_cb (GObject *source_object,
         }
     }
 
+  g_object_unref (widget);
   g_free (message);
   g_free (status);
 }
@@ -716,6 +717,7 @@ account_widget_applied_cb (GObject *source_object,
       if (priv->creating_account)
         {
           /* By default, when an account is created, we enable it. */
+          g_object_ref (widget);
           tp_account_set_enabled_async (account, TRUE,
               account_widget_account_enabled_cb, widget);
           priv->account_created = TRUE;
@@ -745,6 +747,7 @@ account_widget_applied_cb (GObject *source_object,
     }
 
   account_widget_set_control_buttons_sensitivity (widget, FALSE);
+  g_object_unref (widget);
 }
 
 static void
@@ -753,6 +756,7 @@ account_widget_apply_clicked_cb (GtkWidget *button,
 {
   EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
 
+  g_object_ref (self);
   empathy_account_settings_apply_async (priv->settings,
       account_widget_applied_cb, self);
 }
@@ -1194,6 +1198,7 @@ account_widget_switch_flipped_cb (NbtkGtkLightSwitch *sw,
   account = empathy_account_settings_get_account (priv->settings);
 
   /* Enable the account according to the value of the "Enabled" checkbox */
+  g_object_ref (user_data);
   tp_account_set_enabled_async (account, state,
       account_widget_account_enabled_cb, user_data);
 }



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