app: let the tag popup own its tag objects

This should fix crashes in which tag objects got accessed after they
were disposed, because they still were stored with the popup object.
This commit is contained in:
Nils Philippsen 2013-04-16 11:16:41 +02:00
parent 8bfb1769b7
commit b109e05806
1 changed files with 9 additions and 0 deletions

View File

@ -257,6 +257,8 @@ gimp_tag_popup_constructed (GObject *object)
tag_data->tag = tag_iterator->data;
tag_data->state = GTK_STATE_NORMAL;
g_object_ref (tag_data->tag);
for (j = 0; j < current_count; j++)
{
if (! gimp_tag_compare_with_string (tag_data->tag, current_tags[j]))
@ -386,6 +388,13 @@ gimp_tag_popup_dispose (GObject *object)
if (popup->tag_data)
{
gint i;
for (i = 0; i < popup->tag_count; i++)
{
g_object_unref (popup->tag_data[i].tag);
}
g_free (popup->tag_data);
popup->tag_data = NULL;
}