[gimp] app: generically call gimp_tool_control(HALT) in GObject::dispose()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: generically call gimp_tool_control(HALT) in GObject::dispose()
- Date: Fri, 1 Apr 2011 21:32:23 +0000 (UTC)
commit 7a6bf9b5fef7d67c8c21f1b7cb020018094eaa70
Author: Michael Natterer <mitch gimp org>
Date: Fri Apr 1 15:39:37 2011 +0200
app: generically call gimp_tool_control(HALT) in GObject::dispose()
so all the previously added shutdown fragments are executed when the
tool destroyed.
app/tools/gimptool.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index ac4bba5..b5b8551 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -51,6 +51,7 @@ enum
static void gimp_tool_constructed (GObject *object);
+static void gimp_tool_dispose (GObject *object);
static void gimp_tool_finalize (GObject *object);
static void gimp_tool_set_property (GObject *object,
guint property_id,
@@ -143,6 +144,7 @@ gimp_tool_class_init (GimpToolClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_tool_constructed;
+ object_class->dispose = gimp_tool_dispose;
object_class->finalize = gimp_tool_finalize;
object_class->set_property = gimp_tool_set_property;
object_class->get_property = gimp_tool_get_property;
@@ -202,6 +204,16 @@ gimp_tool_constructed (GObject *object)
}
static void
+gimp_tool_dispose (GObject *object)
+{
+ GimpTool *tool = GIMP_TOOL (object);
+
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
gimp_tool_finalize (GObject *object)
{
GimpTool *tool = GIMP_TOOL (object);
@@ -218,12 +230,6 @@ gimp_tool_finalize (GObject *object)
tool->control = NULL;
}
- if (tool->status_displays)
- {
- g_list_free (tool->status_displays);
- tool->status_displays = NULL;
- }
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -1195,18 +1201,8 @@ gimp_tool_options_notify (GimpToolOptions *options,
static void
gimp_tool_clear_status (GimpTool *tool)
{
- GList *list;
-
g_return_if_fail (GIMP_IS_TOOL (tool));
- list = tool->status_displays;
- while (list)
- {
- GimpDisplay *display = list->data;
-
- /* get next element early because we modify the list */
- list = g_list_next (list);
-
- gimp_tool_pop_status (tool, display);
- }
+ while (tool->status_displays)
+ gimp_tool_pop_status (tool, tool->status_displays->data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]