place: Simplify control flow and fix a crash

This commit is contained in:
Jasper St. Pierre 2014-05-20 15:36:28 -04:00
parent 4053c92abf
commit 809568280b

View File

@ -617,13 +617,11 @@ meta_window_place (MetaWindow *window,
int *new_x, int *new_x,
int *new_y) int *new_y)
{ {
GList *windows; GList *windows = NULL;
const MetaMonitorInfo *xi; const MetaMonitorInfo *xi;
meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc); meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc);
windows = NULL;
switch (window->type) switch (window->type)
{ {
/* Run placement algorithm on these. */ /* Run placement algorithm on these. */
@ -649,7 +647,7 @@ meta_window_place (MetaWindow *window,
case META_WINDOW_COMBO: case META_WINDOW_COMBO:
case META_WINDOW_DND: case META_WINDOW_DND:
case META_WINDOW_OVERRIDE_OTHER: case META_WINDOW_OVERRIDE_OTHER:
goto done_no_constraints; goto done;
} }
if (meta_prefs_get_disable_workarounds ()) if (meta_prefs_get_disable_workarounds ())
@ -694,7 +692,7 @@ meta_window_place (MetaWindow *window,
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing non-normal non-dialog window with PPosition set\n"); "Not placing non-normal non-dialog window with PPosition set\n");
goto done_no_constraints; goto done;
} }
break; break;
} }
@ -709,7 +707,7 @@ meta_window_place (MetaWindow *window,
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing window with PPosition or USPosition set\n"); "Not placing window with PPosition or USPosition set\n");
avoid_being_obscured_as_second_modal_dialog (window, &x, &y); 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: done:
g_list_free (windows); if (windows)
g_list_free (windows);
done_no_constraints:
*new_x = x; *new_x = x;
*new_y = y; *new_y = y;