[evolution-data-server/gnome-3-10] Server-side memory leaks in calendar factory



commit 2a1d34376f1fb74276da24a99b7656fa21065775
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 20 20:12:40 2014 +0100

    Server-side memory leaks in calendar factory
    
    This change addresses:
    - typo for GDestroyNotify (was being used ref, instead of unref)
    - leaking data_cal object when opening a calendar
    - DataCalView dispose didn't remove view from the backend
    
    These led to memory leaks on both view and backend objects.

 calendar/libedata-cal/e-data-cal-factory.c |    2 ++
 calendar/libedata-cal/e-data-cal-view.c    |    3 ++-
 calendar/libedata-cal/e-data-cal.c         |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index 87cdc70..dd14baf 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -398,6 +398,8 @@ data_cal_factory_open (EDataCalFactory *factory,
                 * So we must track each and every connection made. */
                data_cal_factory_connections_add (
                        factory, sender, E_CAL_BACKEND (backend));
+
+               g_object_unref (data_cal);
        }
 
        g_object_unref (backend);
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index 55db6ec..c8a49dc 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -251,8 +251,9 @@ impl_DataCalView_dispose (EGdbusCalView *object,
 {
        e_gdbus_cal_view_complete_dispose (object, invocation, NULL);
 
-       view->priv->stopped = TRUE;
        e_cal_backend_stop_view (view->priv->backend, view);
+       view->priv->stopped = TRUE;
+       e_cal_backend_remove_view (view->priv->backend, view);
 
        return TRUE;
 }
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 17315b2..37d3023 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -163,7 +163,7 @@ async_context_new (EDataCal *data_cal,
                (GBusNameAppearedCallback) NULL,
                (GBusNameVanishedCallback) sender_vanished_cb,
                g_object_ref (async_context->cancellable),
-               (GDestroyNotify) g_object_ref);
+               (GDestroyNotify) g_object_unref);
 
        sender_table_insert (
                async_context->data_cal,


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