[gimp] app: properly memory manage GimpColorSelectorPalette's context
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: properly memory manage GimpColorSelectorPalette's context
- Date: Sun, 11 Dec 2011 01:45:38 +0000 (UTC)
commit a25bfabc43f8546542cdbfe3f7fc57e598c9c478
Author: Michael Natterer <mitch gimp org>
Date: Sun Dec 11 02:44:14 2011 +0100
app: properly memory manage GimpColorSelectorPalette's context
so we don't access garbage pointers when the widget is moved between
docks, like when toggling SWM.
app/widgets/gimpcolorselectorpalette.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcolorselectorpalette.c b/app/widgets/gimpcolorselectorpalette.c
index 8a02b9b..d0160d2 100644
--- a/app/widgets/gimpcolorselectorpalette.c
+++ b/app/widgets/gimpcolorselectorpalette.c
@@ -123,6 +123,10 @@ gimp_color_selector_palette_set_config (GimpColorSelector *selector,
g_signal_handlers_disconnect_by_func (select->context,
gimp_color_selector_palette_palette_changed,
select);
+ gimp_view_renderer_set_context (GIMP_VIEW (select->view)->renderer,
+ NULL);
+
+ g_object_unref (select->context);
select->context = NULL;
}
@@ -131,6 +135,8 @@ gimp_color_selector_palette_set_config (GimpColorSelector *selector,
if (select->context)
{
+ g_object_ref (select->context);
+
if (! select->view)
{
GtkWidget *frame;
@@ -159,6 +165,11 @@ gimp_color_selector_palette_set_config (GimpColorSelector *selector,
G_CALLBACK (gimp_color_selector_palette_entry_clicked),
select);
}
+ else
+ {
+ gimp_view_renderer_set_context (GIMP_VIEW (select->view)->renderer,
+ select->context);
+ }
g_signal_connect_object (select->context, "palette-changed",
G_CALLBACK (gimp_color_selector_palette_palette_changed),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]