[folks] Fix a potential crash in Swf.PersonaStore on destruction before preparation



commit bc22db53346c24ccb3dc6d53d00ccda125f6e6cf
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Apr 22 21:59:14 2011 +0100

    Fix a potential crash in Swf.PersonaStore on destruction before preparation
    
    If a Swf.PersonaStore is finalised before .prepare() is called, its
    _contact_view member will be null, so it shouldn't try and disconnect from
    signals from it.

 backends/libsocialweb/lib/swf-persona-store.vala |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/backends/libsocialweb/lib/swf-persona-store.vala b/backends/libsocialweb/lib/swf-persona-store.vala
index 825b337..c6f420a 100644
--- a/backends/libsocialweb/lib/swf-persona-store.vala
+++ b/backends/libsocialweb/lib/swf-persona-store.vala
@@ -134,9 +134,14 @@ public class Swf.PersonaStore : Folks.PersonaStore
 
   ~PersonaStore ()
     {
-      this._contact_view.contacts_added.disconnect (this.contacts_added_cb);
-      this._contact_view.contacts_changed.disconnect (this.contacts_changed_cb);
-      this._contact_view.contacts_removed.disconnect (this.contacts_removed_cb);
+      if (this._contact_view != null)
+        {
+          this._contact_view.contacts_added.disconnect (this.contacts_added_cb);
+          this._contact_view.contacts_changed.disconnect (
+              this.contacts_changed_cb);
+          this._contact_view.contacts_removed.disconnect (
+              this.contacts_removed_cb);
+        }
     }
 
   /**



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