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.
This commit is contained in:
Michael Natterer 2011-12-11 02:44:14 +01:00
parent 94c322ff70
commit a25bfabc43
1 changed files with 11 additions and 0 deletions

View File

@ -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),