[planner] Fix several more memory leaks
- From: Maurice van der Pot <mvdpot src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [planner] Fix several more memory leaks
- Date: Tue, 24 Nov 2009 20:04:44 +0000 (UTC)
commit 60daf96ab8aa75a44321e72c4e9d7cb2bbdc6fd9
Author: Maurice van der Pot <griffon26 kfk4ever com>
Date: Sat Nov 7 00:29:01 2009 +0100
Fix several more memory leaks
src/planner-sidebar.c | 1 +
src/planner-usage-chart.c | 6 ++++--
src/planner-usage-model.c | 3 +++
src/planner-window.c | 14 ++++++++++++--
4 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/planner-sidebar.c b/src/planner-sidebar.c
index 8305ac1..01f7504 100644
--- a/src/planner-sidebar.c
+++ b/src/planner-sidebar.c
@@ -142,6 +142,7 @@ sidebar_finalize (GObject *object)
{
PlannerSidebar *bar = PLANNER_SIDEBAR (object);
+ g_list_foreach (bar->priv->buttons, (GFunc) g_free, NULL);
g_list_free (bar->priv->buttons);
g_free (bar->priv);
diff --git a/src/planner-usage-chart.c b/src/planner-usage-chart.c
index 8458c74..ae6d143 100644
--- a/src/planner-usage-chart.c
+++ b/src/planner-usage-chart.c
@@ -567,6 +567,7 @@ usage_chart_finalize (GObject *object)
chart = PLANNER_USAGE_CHART (object);
+ g_free (chart->priv->tree);
g_free (chart->priv);
if (G_OBJECT_CLASS (parent_class)->finalize) {
@@ -582,6 +583,7 @@ usage_chart_destroy (GtkObject *object)
chart = PLANNER_USAGE_CHART (object);
if (chart->priv->model != NULL) {
+ usage_chart_disconnect_signals (chart);
g_object_unref (chart->priv->model);
chart->priv->model = NULL;
}
@@ -946,8 +948,8 @@ planner_usage_chart_new_with_model (GtkTreeModel *model)
{
PlannerUsageChart *chart;
- chart = PLANNER_USAGE_CHART (gtk_type_new
- (planner_usage_chart_get_type ()));
+ chart = g_object_new (PLANNER_TYPE_USAGE_CHART, NULL);
+
if (model) {
planner_usage_chart_set_model (chart, model);
}
diff --git a/src/planner-usage-model.c b/src/planner-usage-model.c
index 2715868..e73ca60 100644
--- a/src/planner-usage-model.c
+++ b/src/planner-usage-model.c
@@ -135,6 +135,9 @@ usage_model_finalize (GObject *object)
{
PlannerUsageModel *model = PLANNER_USAGE_MODEL (object);
+ g_hash_table_destroy (model->priv->assign2node);
+ g_hash_table_destroy (model->priv->resource2node);
+ g_node_destroy (model->priv->tree);
g_free (model->priv);
if (G_OBJECT_CLASS (parent_class)->finalize) {
diff --git a/src/planner-window.c b/src/planner-window.c
index c9494db..699f582 100644
--- a/src/planner-window.c
+++ b/src/planner-window.c
@@ -399,6 +399,10 @@ window_finalize (GObject *object)
PlannerWindow *window = PLANNER_WINDOW (object);
PlannerWindowPriv *priv = window->priv;
+ if (priv->plugins) {
+ g_list_free (priv->plugins);
+ }
+
if (priv->views) {
g_list_foreach (priv->views, (GFunc) g_object_unref, NULL);
g_list_free (priv->views);
@@ -682,8 +686,6 @@ window_populate (PlannerWindow *window)
r_entries[view_num].name = planner_view_get_name (view);
r_entries[view_num].label = planner_view_get_menu_label (view);
r_entries[view_num].value = view_num;
-
- /* Note: these strings are leaked. */
r_entries[view_num].tooltip = g_strdup_printf (_("Switch to the view \"%s\""),
planner_view_get_label (view));
@@ -704,6 +706,14 @@ window_populate (PlannerWindow *window)
G_CALLBACK (window_view_cb),
window);
+ view_num = 0;
+ for (l = priv->views; l; l = l->next, view_num++ ) {
+ /* Cast off const so we can free the string we allocated */
+ gchar *tooltip = (gchar *)(r_entries[view_num].tooltip);
+ g_free (tooltip);
+ }
+ g_free (r_entries);
+
xml_string_tmp = g_strdup_printf (xml_string_full, xml_string);
gtk_ui_manager_add_ui_from_string (priv->ui_manager, xml_string_tmp, -1, NULL);
g_free (xml_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]