[gimp] app: don't forget to free the models of the dynamics and preset editors
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't forget to free the models of the dynamics and preset editors
- Date: Sun, 11 Apr 2010 13:54:47 +0000 (UTC)
commit 1c786ae5d4d7e628f57cfe01c316e8b873362e02
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 11 15:54:09 2010 +0200
app: don't forget to free the models of the dynamics and preset editors
app/widgets/gimpdynamicseditor.c | 16 ++++++++++++++
app/widgets/gimptoolpreseteditor.c | 40 ++++++++++++++++++++++++-----------
2 files changed, 43 insertions(+), 13 deletions(-)
---
diff --git a/app/widgets/gimpdynamicseditor.c b/app/widgets/gimpdynamicseditor.c
index 09410a0..4d7ec30 100644
--- a/app/widgets/gimpdynamicseditor.c
+++ b/app/widgets/gimpdynamicseditor.c
@@ -43,6 +43,7 @@
static GObject * gimp_dynamics_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
+static void gimp_dynamics_editor_finalize (GObject *object);
static void gimp_dynamics_editor_set_data (GimpDataEditor *editor,
GimpData *data);
@@ -87,6 +88,7 @@ gimp_dynamics_editor_class_init (GimpDynamicsEditorClass *klass)
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
object_class->constructor = gimp_dynamics_editor_constructor;
+ object_class->finalize = gimp_dynamics_editor_finalize;
editor_class->set_data = gimp_dynamics_editor_set_data;
editor_class->title = _("Paint Dynamics Editor");
@@ -184,6 +186,20 @@ gimp_dynamics_editor_constructor (GType type,
}
static void
+gimp_dynamics_editor_finalize (GObject *object)
+{
+ GimpDynamicsEditor *editor = GIMP_DYNAMICS_EDITOR (object);
+
+ if (editor->dynamics_model)
+ {
+ g_object_unref (editor->dynamics_model);
+ editor->dynamics_model = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
gimp_dynamics_editor_set_data (GimpDataEditor *editor,
GimpData *data)
{
diff --git a/app/widgets/gimptoolpreseteditor.c b/app/widgets/gimptoolpreseteditor.c
index 954107c..84fc437 100644
--- a/app/widgets/gimptoolpreseteditor.c
+++ b/app/widgets/gimptoolpreseteditor.c
@@ -38,19 +38,20 @@
/* local function prototypes */
-static GObject * gimp_tool_preset_editor_constructor (GType type,
- guint n_params,
- GObjectConstructParam *params);
+static GObject * gimp_tool_preset_editor_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static void gimp_tool_preset_editor_finalize (GObject *object);
-static void gimp_tool_preset_editor_set_data (GimpDataEditor *editor,
- GimpData *data);
+static void gimp_tool_preset_editor_set_data (GimpDataEditor *editor,
+ GimpData *data);
-static void gimp_tool_preset_editor_notify_model (GimpToolPreset *options,
- const GParamSpec *pspec,
- GimpToolPresetEditor *editor);
-static void gimp_tool_preset_editor_notify_data (GimpToolPreset *options,
- const GParamSpec *pspec,
- GimpToolPresetEditor *editor);
+static void gimp_tool_preset_editor_notify_model (GimpToolPreset *options,
+ const GParamSpec *pspec,
+ GimpToolPresetEditor *editor);
+static void gimp_tool_preset_editor_notify_data (GimpToolPreset *options,
+ const GParamSpec *pspec,
+ GimpToolPresetEditor *editor);
@@ -68,6 +69,7 @@ gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
object_class->constructor = gimp_tool_preset_editor_constructor;
+ object_class->finalize = gimp_tool_preset_editor_finalize;
editor_class->set_data = gimp_tool_preset_editor_set_data;
editor_class->title = _("Tool Preset Editor");
@@ -76,8 +78,6 @@ gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
static void
gimp_tool_preset_editor_init (GimpToolPresetEditor *editor)
{
- GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
-
editor->tool_preset_model = g_object_new (GIMP_TYPE_TOOL_PRESET, NULL);
}
@@ -96,6 +96,20 @@ gimp_tool_preset_editor_constructor (GType type,
}
static void
+gimp_tool_preset_editor_finalize (GObject *object)
+{
+ GimpToolPresetEditor *editor = GIMP_TOOL_PRESET_EDITOR (object);
+
+ if (editor->tool_preset_model)
+ {
+ g_object_unref (editor->tool_preset_model);
+ editor->tool_preset_model = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
gimp_tool_preset_editor_set_data (GimpDataEditor *editor,
GimpData *data)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]