Commit a8e599eb authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/widgets/gimpcontainercombobox.[ch] when removing the last item from

2004-08-11  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainercombobox.[ch]
	* app/widgets/gimpcontainertreeview.c: when removing the last item
	from the view, manually clear all GimpCellRendererViewables'
	"renderer" properties; otherwise we have stale GimpPreviewRenderers
	with still-refed viewables hanging around in the cells.
	Works around GTK+ bug #149906.
parent db1d6b0d
2004-08-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainercombobox.[ch]
* app/widgets/gimpcontainertreeview.c: when removing the last item
from the view, manually clear all GimpCellRendererViewables'
"renderer" properties; otherwise we have stale GimpPreviewRenderers
with still-refed viewables hanging around in the cells.
Works around GTK+ bug #149906.
2004-08-11 Michael Natterer <mitch@gimp.org>
* app/core/gimp.c
......
......@@ -167,6 +167,8 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
"renderer", COLUMN_RENDERER,
NULL);
combo_box->viewable_renderer = cell;
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (layout, cell, TRUE);
gtk_cell_layout_set_attributes (layout, cell,
......@@ -297,7 +299,20 @@ gimp_container_combo_box_remove_item (GimpContainerView *view,
GtkTreeIter *iter = insert_data;
if (iter)
gtk_list_store_remove (GTK_LIST_STORE (model), iter);
{
gtk_list_store_remove (GTK_LIST_STORE (model), iter);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as bug #149906 is fixed
#endif
/* if the store is empty after this remove, clear out renderers
* from all cells so they don't keep refing the viewables
*/
if (! gtk_tree_model_iter_n_children (model, NULL))
g_object_set (GIMP_CONTAINER_COMBO_BOX (view)->viewable_renderer,
"renderer", NULL,
NULL);
}
}
static void
......
......@@ -38,12 +38,14 @@ typedef struct _GimpContainerComboBoxClass GimpContainerComboBoxClass;
struct _GimpContainerComboBox
{
GtkComboBox parent_instance;
GtkComboBox parent_instance;
GtkCellRenderer *viewable_renderer;
};
struct _GimpContainerComboBoxClass
{
GtkComboBoxClass parent_class;
GtkComboBoxClass parent_class;
};
......
......@@ -533,7 +533,23 @@ gimp_container_tree_view_remove_item (GimpContainerView *view,
GtkTreeIter *iter = (GtkTreeIter *) insert_data;
if (iter)
gtk_list_store_remove (GTK_LIST_STORE (tree_view->model), iter);
{
gtk_list_store_remove (GTK_LIST_STORE (tree_view->model), iter);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as bug #149906 is fixed
#endif
/* if the store is empty after this remove, clear out renderers
* from all cells so they don't keep refing the viewables
*/
if (! gtk_tree_model_iter_n_children (tree_view->model, NULL))
{
GList *list;
for (list = tree_view->renderer_cells; list; list = g_list_next (list))
g_object_set (list->data, "renderer", NULL, NULL);
}
}
}
static void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment