From 3e97490e1d3ebf7dc1a52cdd4a4ca3d01502bb6b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 19 Jun 2015 07:35:00 -0300 Subject: [PATCH] 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 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gcal-manager.c b/src/gcal-manager.c index 2ffc1d2e..03f03361 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); }