diff options
Diffstat (limited to 'libmate-desktop/mate-bg.c')
-rw-r--r-- | libmate-desktop/mate-bg.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c index e8c198a..c213354 100644 --- a/libmate-desktop/mate-bg.c +++ b/libmate-desktop/mate-bg.c @@ -1651,7 +1651,7 @@ mate_bg_set_root_pixmap_id (GdkScreen *screen, Atom atoms[G_N_ELEMENTS(atom_names)] = {0}; Atom type; - int format; + int format, result; unsigned long nitems, after; unsigned char *data_root, *data_esetroot; @@ -1659,20 +1659,24 @@ mate_bg_set_root_pixmap_id (GdkScreen *screen, * This method is to avoid multiple round-trips to Xserver */ if (XInternAtoms (display, atom_names, G_N_ELEMENTS(atom_names), True, atoms) && - atoms[0] != None && atoms[1] != None) - { - XGetWindowProperty (display, xroot, atoms[0], 0L, 1L, False, AnyPropertyType, - &type, &format, &nitems, &after, &data_root); - if (data_root && type == XA_PIXMAP && format == 32 && nitems == 1) - { - XGetWindowProperty (display, xroot, atoms[1], 0L, 1L, False, AnyPropertyType, - &type, &format, &nitems, &after, &data_esetroot); - if (data_esetroot && type == XA_PIXMAP && format == 32 && nitems == 1) - { + atoms[0] != None && atoms[1] != None) { + result = XGetWindowProperty (display, xroot, atoms[0], 0L, 1L, + False, AnyPropertyType, + &type, &format, &nitems, &after, + &data_root); + + if (data_root != NULL && result == Success && + type == XA_PIXMAP && format == 32 && nitems == 1) { + result = XGetWindowProperty (display, xroot, atoms[1], + 0L, 1L, False, + AnyPropertyType, + &type, &format, &nitems, + &after, &data_esetroot); + + if (data_esetroot != NULL && result == Success && + type == XA_PIXMAP && format == 32 && nitems == 1) { Pixmap xrootpmap = *((Pixmap *) data_root); Pixmap esetrootpmap = *((Pixmap *) data_esetroot); - XFree (data_root); - XFree (data_esetroot); gdk_error_trap_push (); if (xrootpmap && xrootpmap == esetrootpmap) { @@ -1686,6 +1690,12 @@ mate_bg_set_root_pixmap_id (GdkScreen *screen, # endif gdk_error_trap_pop_ignored (); } + if (data_esetroot != NULL) { + XFree (data_esetroot); + } + } + if (data_root != NULL) { + XFree (data_root); } } |