[gimp] app: ref the session info in gimp_dialog_factory_add_session_info()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: ref the session info in gimp_dialog_factory_add_session_info()
- Date: Thu, 12 May 2011 20:01:02 +0000 (UTC)
commit 6bf7f7e42957230cf86d72e2ccf8d059fb6c01ac
Author: Michael Natterer <mitch gimp org>
Date: Thu May 12 21:12:59 2011 +0200
app: ref the session info in gimp_dialog_factory_add_session_info()
and unref it in the callers after adding it. That's the proper way of
doing it and fixes another warning when restoring a dock fails.
app/actions/windows-commands.c | 6 +++++-
app/gui/session.c | 4 ++--
app/widgets/gimpdialogfactory.c | 7 +++++--
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 2f73b1c..dd37e74 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -99,10 +99,14 @@ windows_open_recent_cmd_callback (GtkAction *action,
GimpSessionInfo *info = g_object_get_data (G_OBJECT (action), "info");
g_object_ref (info);
+
gimp_container_remove (global_recent_docks, GIMP_OBJECT (info));
- gimp_dialog_factory_add_session_info (gimp_dialog_factory_get_singleton (), info);
+ gimp_dialog_factory_add_session_info (gimp_dialog_factory_get_singleton (),
+ info);
gimp_session_info_restore (info, gimp_dialog_factory_get_singleton ());
gimp_session_info_clear_info (info);
+
+ g_object_unref (info);
}
diff --git a/app/gui/session.c b/app/gui/session.c
index e457448..0f6fc22 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -205,9 +205,9 @@ session_init (Gimp *gimp)
GIMP_LOG (DIALOG_FACTORY,
"failed to parse session info %p, not adding",
info);
-
- g_object_unref (info);
}
+
+ g_object_unref (info);
}
else
{
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index cb10884..b0a7312 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -682,11 +682,13 @@ gimp_dialog_factory_add_session_info (GimpDialogFactory *factory,
GimpSessionInfo *info)
{
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
+ g_return_if_fail (GIMP_IS_SESSION_INFO (info));
/* We want to append rather than prepend so that the serialized
* order in sessionrc remains the same
*/
- factory->p->session_infos = g_list_append (factory->p->session_infos, info);
+ factory->p->session_infos = g_list_append (factory->p->session_infos,
+ g_object_ref (info));
}
/**
@@ -911,7 +913,8 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
NULL);
}
- factory->p->session_infos = g_list_append (factory->p->session_infos, info);
+ gimp_dialog_factory_add_session_info (factory, info);
+ g_object_unref (info);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]