[mutter] place: Simplify control flow and fix a crash



commit 809568280b996c67d43e2a35e2721d8b6b0cf0b0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue May 20 15:36:28 2014 -0400

    place: Simplify control flow and fix a crash

 src/core/place.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/core/place.c b/src/core/place.c
index abb1ac2..57104b3 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -617,13 +617,11 @@ meta_window_place (MetaWindow        *window,
                    int               *new_x,
                    int               *new_y)
 {
-  GList *windows;
+  GList *windows = NULL;
   const MetaMonitorInfo *xi;
 
   meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc);
 
-  windows = NULL;
-
   switch (window->type)
     {
       /* Run placement algorithm on these. */
@@ -649,7 +647,7 @@ meta_window_place (MetaWindow        *window,
     case META_WINDOW_COMBO:
     case META_WINDOW_DND:
     case META_WINDOW_OVERRIDE_OTHER:
-      goto done_no_constraints;
+      goto done;
     }
 
   if (meta_prefs_get_disable_workarounds ())
@@ -694,7 +692,7 @@ meta_window_place (MetaWindow        *window,
             {
               meta_topic (META_DEBUG_PLACEMENT,
                           "Not placing non-normal non-dialog window with PPosition set\n");
-              goto done_no_constraints;
+              goto done;
             }
           break;
         }
@@ -709,7 +707,7 @@ meta_window_place (MetaWindow        *window,
           meta_topic (META_DEBUG_PLACEMENT,
                       "Not placing window with PPosition or USPosition set\n");
           avoid_being_obscured_as_second_modal_dialog (window, &x, &y);
-          goto done_no_constraints;
+          goto done;
         }
     }
 
@@ -888,9 +886,8 @@ meta_window_place (MetaWindow        *window,
     }
 
  done:
-  g_list_free (windows);
-
- done_no_constraints:
+  if (windows)
+    g_list_free (windows);
 
   *new_x = x;
   *new_y = y;


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