[gnome-flashback] common: initialize prop variables



commit 12b48cac119979dfd377dae6ffbcbfefca689ffd
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Jan 22 16:32:13 2020 +0200

    common: initialize prop variables

 gnome-flashback/libcommon/gf-background-utils.c | 28 ++++++++++++-------------
 1 file changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/gnome-flashback/libcommon/gf-background-utils.c b/gnome-flashback/libcommon/gf-background-utils.c
index 38ce1ca..853b982 100644
--- a/gnome-flashback/libcommon/gf-background-utils.c
+++ b/gnome-flashback/libcommon/gf-background-utils.c
@@ -154,8 +154,8 @@ get_root_pixmap (GdkDisplay *display)
   Pixmap pixmap;
 
   xdisplay = gdk_x11_display_get_xdisplay (display);
-
   xrootpmap_id_atom = XInternAtom (xdisplay, "_XROOTPMAP_ID", False);
+  prop = NULL;
 
   result = XGetWindowProperty (xdisplay,
                                XDefaultRootWindow (xdisplay),
@@ -175,8 +175,7 @@ get_root_pixmap (GdkDisplay *display)
       actual_format != 32 ||
       n_items != 1)
     {
-      if (prop != NULL)
-        XFree (prop);
+      XFree (prop);
 
       return None;
     }
@@ -265,6 +264,7 @@ set_root_pixmap (GdkDisplay *display,
 
   esetroot_pmap_id_atom = XInternAtom (xdisplay, "ESETROOT_PMAP_ID", False);
   xrootpmap_id_atom = XInternAtom (xdisplay, "_XROOTPMAP_ID", False);
+  prop = NULL;
 
   result = XGetWindowProperty (xdisplay,
                                XDefaultRootWindow (xdisplay),
@@ -279,23 +279,21 @@ set_root_pixmap (GdkDisplay *display,
                                &bytes_after,
                                &prop);
 
-  if (prop != NULL)
+  if (result == Success &&
+      actual_type == XA_PIXMAP &&
+      actual_format == 32 &&
+      n_items == 1 &&
+      prop != NULL)
     {
-      if (result == Success &&
-          actual_type == XA_PIXMAP &&
-          actual_format == 32 &&
-          n_items == 1)
-        {
-          gdk_x11_display_error_trap_push (display);
-
-          XKillClient (xdisplay, *(Pixmap *) prop);
+      gdk_x11_display_error_trap_push (display);
 
-          gdk_x11_display_error_trap_pop_ignored (display);
-        }
+      XKillClient (xdisplay, *(Pixmap *) prop);
 
-      XFree (prop);
+      gdk_x11_display_error_trap_pop_ignored (display);
     }
 
+  XFree (prop);
+
   XChangeProperty (xdisplay,
                    XDefaultRootWindow (xdisplay),
                    esetroot_pmap_id_atom,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]