[gnome-calendar] gcal-window: fixed memory leak when handling date



commit 3327207c9d840b0a6f6dd297484811dbb98dfe4f
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Jun 6 10:21:02 2013 -0400

    gcal-window: fixed memory leak when handling date
    
    Fixed construction method

 src/gcal-window.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index c00a716..21ced28 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -245,9 +245,6 @@ gcal_window_constructed (GObject *object)
 
   priv = GCAL_WINDOW (object)->priv;
 
-  /* internal data init */
-  priv->active_date = g_new (icaltimetype, 1);
-
   /* ui construction */
   priv->main_box = gtk_grid_new ();
   gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->main_box),
@@ -386,6 +383,8 @@ gcal_window_set_property (GObject      *object,
                                    g_value_get_enum (value));
       return;
     case PROP_ACTIVE_DATE:
+      if (priv->active_date != NULL)
+        g_free (priv->active_date);
       priv->active_date = g_value_dup_boxed (value);
       return;
     }
@@ -1281,18 +1280,18 @@ gcal_window_new_with_view (GcalApplication   *app,
 {
   GcalWindow *win;
   GcalManager *manager;
+  icaltimetype date;
+
+  manager = gcal_application_get_manager (GCAL_APPLICATION (app));
+  /* FIXME: here read the initial date from somewehere */
+  date = icaltime_current_time_with_zone (gcal_manager_get_system_timezone (manager));
 
   win  =  g_object_new (GCAL_TYPE_WINDOW,
                         "application",
                         GTK_APPLICATION (app),
+                        "active-date",
+                        &date,
                         NULL);
-  gcal_window_set_sources_view (win);
-
-  manager = gcal_window_get_manager (win);
-
-  /* FIXME: here read the initial date from somewehere */
-  *(win->priv->active_date) =
-    icaltime_current_time_with_zone (gcal_manager_get_system_timezone (manager));
 
   /* hooking signals */
   g_signal_connect (manager,


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