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.
This commit is contained in:
committed by
Michael Natterer
parent
db1d6b0d6e
commit
a8e599ebbf
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user