[gnome-calendar/gnome-3-28] manager: fix reference management



commit 482d9fe3172d6f2f263cbf8c317a7ebe4cd14dfc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Apr 30 21:26:03 2018 -0300

    manager: fix reference management
    
    GcalManager:remove_event() is an asynchronous function
    that, by the time the callback is executed, unreferences
    the event that is being removed. This implies that, when
    the function was called, a reference was taken -- we don't
    want the event to be finalized during the operation, after
    all.
    
    The problem is that the reference was never taken.
    
    Fix that by properly owning a reference to the event when
    removing it, and dropping it when the removal is finished.
    
    Issue: #268

 src/gcal-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 385d7e09..d36b07da 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -1715,7 +1715,7 @@ gcal_manager_remove_event (GcalManager           *self,
                               (ECalObjModType) mod,
                               self->async_ops,
                               on_event_removed,
-                              event);
+                              g_object_ref (event));
 
   g_free (rid);
 


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