[gnome-calendar] Bug 751211 - crash on ESource::read-only property change notification



commit 3e97490e1d3ebf7dc1a52cdd4a4ca3d01502bb6b
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jun 19 07:35:00 2015 -0300

    Bug 751211 - crash on ESource::read-only property change notification
    
    Two things changes:
    a) the actual crash cause in on_client_readonly_changed(), to test whether
       the 'unit' is valid at all before dereferencing it
    b) the callback doesn't seem to be disconnected at all, thus added a disconnect
       of it on the source removal as well
    
    The b) might be enough, but just to be sure I included also a).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751211

 src/gcal-manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 2ffc1d2..03f0336 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -402,7 +402,7 @@ on_client_readonly_changed (EClient    *client,
   source = e_client_get_source (client);
 
   unit = g_hash_table_lookup (priv->clients, source);
-  if (unit->enabled)
+  if (unit && unit->enabled)
     g_signal_emit (GCAL_MANAGER (user_data), signals[SOURCE_ACTIVATED], 0, source, !e_client_is_readonly 
(client));
 }
 
@@ -518,6 +518,7 @@ remove_source (GcalManager  *manager,
                ESource      *source)
 {
   GcalManagerPrivate *priv;
+  GcalManagerUnit *unit;
 
   g_return_if_fail (GCAL_IS_MANAGER (manager));
   g_return_if_fail (E_IS_SOURCE (source));
@@ -528,6 +529,11 @@ remove_source (GcalManager  *manager,
                                   e_source_get_uid (source));
   e_cal_data_model_remove_client (priv->search_data_model,
                                   e_source_get_uid (source));
+
+  unit = g_hash_table_lookup (priv->clients, source);
+  if (unit && unit->client)
+     g_signal_handlers_disconnect_by_data (unit->client, manager);
+
   g_hash_table_remove (priv->clients, source);
   g_signal_emit (manager, signals[SOURCE_REMOVED], 0, source);
 }


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