Handle pixbuf being NULL without warnings. Also, don't leak pixbuf

2005-08-19  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkfilechooserbutton.c (change_icon_theme)
	(model_add_special, model_add_special, model_add_volumes):
	Handle pixbuf being NULL without warnings. Also, don't
	leak pixbuf references when the icon theme is changed.
This commit is contained in:
Matthias Clasen 2005-08-19 18:21:31 +00:00 committed by Matthias Clasen
parent 37ef7f0389
commit 313b8ffabf
4 changed files with 24 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2005-08-19 Matthias Clasen <mclasen@redhat.com> 2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (change_icon_theme)
(model_add_special, model_add_special, model_add_volumes):
Handle pixbuf being NULL without warnings. Also, don't
leak pixbuf references when the icon theme is changed.
* gtk/gtkmain.c (gtk_get_event_widget): Don't access * gtk/gtkmain.c (gtk_get_event_widget): Don't access
the user data on destroyed windows, since at best the user data on destroyed windows, since at best
it can be a stale pointer. (#313953, Robin Green) it can be a stale pointer. (#313953, Robin Green)

View File

@ -1,5 +1,10 @@
2005-08-19 Matthias Clasen <mclasen@redhat.com> 2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (change_icon_theme)
(model_add_special, model_add_special, model_add_volumes):
Handle pixbuf being NULL without warnings. Also, don't
leak pixbuf references when the icon theme is changed.
* gtk/gtkmain.c (gtk_get_event_widget): Don't access * gtk/gtkmain.c (gtk_get_event_widget): Don't access
the user data on destroyed windows, since at best the user data on destroyed windows, since at best
it can be a stale pointer. (#313953, Robin Green) it can be a stale pointer. (#313953, Robin Green)

View File

@ -1,5 +1,10 @@
2005-08-19 Matthias Clasen <mclasen@redhat.com> 2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (change_icon_theme)
(model_add_special, model_add_special, model_add_volumes):
Handle pixbuf being NULL without warnings. Also, don't
leak pixbuf references when the icon theme is changed.
* gtk/gtkmain.c (gtk_get_event_widget): Don't access * gtk/gtkmain.c (gtk_get_event_widget): Don't access
the user data on destroyed windows, since at best the user data on destroyed windows, since at best
it can be a stale pointer. (#313953, Robin Green) it can be a stale pointer. (#313953, Robin Green)

View File

@ -1109,6 +1109,9 @@ change_icon_theme (GtkFileChooserButton *button)
gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter, gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
ICON_COLUMN, pixbuf, ICON_COLUMN, pixbuf,
-1); -1);
if (pixbuf)
g_object_unref (pixbuf);
} }
while (gtk_tree_model_iter_next (priv->model, &iter)); while (gtk_tree_model_iter_next (priv->model, &iter));
@ -1311,7 +1314,8 @@ model_add_special (GtkFileChooserButton *button)
DATA_COLUMN, path, DATA_COLUMN, path,
-1); -1);
g_object_unref (pixbuf); if (pixbuf)
g_object_unref (pixbuf);
button->priv->n_special++; button->priv->n_special++;
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
@ -1339,7 +1343,8 @@ model_add_special (GtkFileChooserButton *button)
DATA_COLUMN, path, DATA_COLUMN, path,
-1); -1);
g_object_unref (pixbuf); if (pixbuf)
g_object_unref (pixbuf);
button->priv->n_special++; button->priv->n_special++;
} }
} }
@ -1379,7 +1384,8 @@ model_add_volumes (GtkFileChooserButton *button,
DATA_COLUMN, volumes->data, DATA_COLUMN, volumes->data,
-1); -1);
g_object_unref (pixbuf); if (pixbuf)
g_object_unref (pixbuf);
g_free (display_name); g_free (display_name);
button->priv->n_volumes++; button->priv->n_volumes++;