summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-12-15 15:03:34 +0300
committerMonsta <[email protected]>2015-12-15 15:03:34 +0300
commitea28835a8bcd655cf46faaf53daba8ea6b72f067 (patch)
tree064f2f679e33b5b58a2578996afb9cc3678f9346
parent59d0d8cdab4d8f6712a6dfa58c69a1312b867228 (diff)
downloadmate-netbook-ea28835a8bcd655cf46faaf53daba8ea6b72f067.tar.bz2
mate-netbook-ea28835a8bcd655cf46faaf53daba8ea6b72f067.tar.xz
window picker: fix improper pixbuf lifetime handling
from https://github.com/lanoxx/window-picker-applet/commit/de838923ec9f9ce8639bb54489fdddcda4af0e90
-rw-r--r--mate-window-picker-applet/task-item.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/mate-window-picker-applet/task-item.c b/mate-window-picker-applet/task-item.c
index 860fc6c..24a4806 100644
--- a/mate-window-picker-applet/task-item.c
+++ b/mate-window-picker-applet/task-item.c
@@ -291,7 +291,6 @@ task_item_expose_event (GtkWidget *widget,
TaskItem *item;
GdkRectangle area;
TaskItemPrivate *priv;
- GdkPixbuf *desat;
GdkPixbuf *pbuf;
g_return_val_if_fail (widget != NULL, FALSE);
@@ -311,7 +310,6 @@ task_item_expose_event (GtkWidget *widget,
#endif
pbuf = priv->pixbuf;
- desat = NULL;
gint size = MIN (area.height, area.width);
gboolean active = wnck_window_is_active (priv->window);
@@ -350,7 +348,7 @@ task_item_expose_event (GtkWidget *widget,
}
else
{
- desat = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ GdkPixbuf *desat = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE,
gdk_pixbuf_get_bits_per_sample (pbuf),
gdk_pixbuf_get_width (pbuf),
@@ -365,12 +363,13 @@ task_item_expose_event (GtkWidget *widget,
}
else /* just paint the colored version as a fallback */
{
- desat = pbuf;
+ desat = g_object_ref (pbuf);
}
gdk_cairo_set_source_pixbuf (cr,
desat,
(area.x + (area.width - gdk_pixbuf_get_width (desat)) / 2),
(area.y + (area.height - gdk_pixbuf_get_height (desat)) / 2));
+ g_object_unref (desat);
}
if (!priv->mouse_over && attention) /* urgent */
{
@@ -391,10 +390,7 @@ task_item_expose_event (GtkWidget *widget,
{
cairo_paint_with_alpha (cr, .65);
}
-
- if (GDK_IS_PIXBUF (desat))
- g_object_unref (desat);
-
+
#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr);
#endif