[evolution-ews] Disconnect signal handlers on connection object in dispose of book/calendar backend



commit 7843cc1d8e4122608206faaab929188caf83cad2
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 31 11:30:32 2019 +0100

    Disconnect signal handlers on connection object in dispose of book/calendar backend
    
    The signal handlers could be called after the backend was freed,
    causing a crash of the respective factory. That's because the connection
    object can be shared between backends, thus it can live longer than
    the backends.

 src/addressbook/e-book-backend-ews.c | 6 +-----
 src/calendar/e-cal-backend-ews.c     | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 34de8ffa..e8412d3d 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -4035,11 +4035,7 @@ e_book_backend_ews_dispose (GObject *object)
 {
        EBookBackendEws *bbews = E_BOOK_BACKEND_EWS (object);
 
-       g_rec_mutex_lock (&bbews->priv->cnc_lock);
-
-       g_clear_object (&bbews->priv->cnc);
-
-       g_rec_mutex_unlock (&bbews->priv->cnc_lock);
+       ebb_ews_unset_connection (bbews);
 
        /* Chain up to parent's method. */
        G_OBJECT_CLASS (e_book_backend_ews_parent_class)->dispose (object);
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index c4586cdf..c7d695a3 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -4253,11 +4253,7 @@ ecb_ews_dispose (GObject *object)
 {
        ECalBackendEws *cbews = E_CAL_BACKEND_EWS (object);
 
-       g_rec_mutex_lock (&cbews->priv->cnc_lock);
-
-       g_clear_object (&cbews->priv->cnc);
-
-       g_rec_mutex_unlock (&cbews->priv->cnc_lock);
+       ecb_ews_unset_connection (cbews);
 
        /* Chain up to parent's method. */
        G_OBJECT_CLASS (e_cal_backend_ews_parent_class)->dispose (object);


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