[Xfce4-commits] [xfce/xfwm4] 02/03: pixmap: Avoid warning without icon
noreply at xfce.org
noreply at xfce.org
Sun Jan 21 17:05:18 CET 2018
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit 10d59eabac41373ddd9018dd250a5855d94fd295
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Sun Jan 21 16:54:50 2018 +0100
pixmap: Avoid warning without icon
---
src/client.c | 12 +++++++-----
src/mypixmap.c | 6 ++++++
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/client.c b/src/client.c
index 8ea3bd4..0de213d 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1494,15 +1494,17 @@ clientUpdateIconPix (Client *c)
if (size > 1)
{
icon = getAppIcon (screen_info, c->window, size, size);
-
- for (i = 0; i < STATE_TOGGLED; i++)
+ if (icon)
{
- if (!xfwmPixmapNone(&c->appmenu[i]))
+ for (i = 0; i < STATE_TOGGLED; i++)
{
- xfwmPixmapRenderGdkPixbuf (&c->appmenu[i], icon);
+ if (!xfwmPixmapNone(&c->appmenu[i]))
+ {
+ xfwmPixmapRenderGdkPixbuf (&c->appmenu[i], icon);
+ }
}
+ g_object_unref (icon);
}
- g_object_unref (icon);
}
}
diff --git a/src/mypixmap.c b/src/mypixmap.c
index 334f159..99de89a 100644
--- a/src/mypixmap.c
+++ b/src/mypixmap.c
@@ -906,6 +906,7 @@ xfwmPixmapRenderGdkPixbuf (xfwmPixmap * pm, GdkPixbuf *pixbuf)
g_return_val_if_fail (pm != NULL, FALSE);
g_return_val_if_fail (pm->pixmap != None, FALSE);
g_return_val_if_fail (pm->mask != None, FALSE);
+ g_return_val_if_fail (pixbuf != NULL, FALSE);
surface = xfwmPixmapCreateSurface (pm, FALSE);
@@ -923,6 +924,11 @@ xfwmPixmapRenderGdkPixbuf (xfwmPixmap * pm, GdkPixbuf *pixbuf)
dest_y = (pm->height - height + 1) / 2;
src = gdk_pixbuf_get_from_surface (surface, dest_x, dest_y, width, height);
+ if (!src)
+ {
+ g_warning ("Cannot get pixbuf");
+ return FALSE;
+ }
gdk_pixbuf_composite (pixbuf, src, 0, 0, width, height,
0, 0, 1.0, 1.0, GDK_INTERP_BILINEAR, 0xFF);
cr = cairo_create (surface);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list