[gnome-calendar] month-view: clear the pointer when it's not stored in place



commit e6c9ecd7ebe6449f6fee9057a47a728a73e838f1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed May 18 11:57:43 2016 -0300

    month-view: clear the pointer when it's not stored in place
    
    It leaks a reference, but only happens for end date.

 src/gcal-month-view.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index bf65aa6..c300285 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -277,6 +277,8 @@ show_popover_for_position (GcalMonthView *view,
     }
   else
     {
+      gboolean should_clear_end = FALSE;
+
       /* Swap dates if start > end */
       if (g_date_time_compare (start_dt, end_dt) > 0)
         {
@@ -297,10 +299,15 @@ show_popover_for_position (GcalMonthView *view,
                                           0, 0, 0);
           end_dt = g_date_time_add_days (tmp_dt, 1);
 
+          should_clear_end = TRUE;
+
           g_clear_pointer (&tmp_dt, g_date_time_unref);
         }
 
       g_signal_emit_by_name (GCAL_VIEW (widget), "create-event", start_dt, end_dt, x, y);
+
+      if (should_clear_end)
+        g_clear_pointer (&end_dt, g_date_time_unref);
     }
 
   gtk_widget_queue_draw (widget);


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