meta_window_move_frame(): fix crash when frame is NULL
authorOwen W. Taylor <otaylor@fishsoup.net>
Tue, 1 May 2012 17:40:08 +0000 (13:40 -0400)
committerMichael Biebl <biebl@debian.org>
Sat, 7 Jul 2012 18:03:06 +0000 (18:03 +0000)
When meta_frame_calc_borders() was made to take a NULL frame argument,
a crash was accidentally introduced into meta_window_move_frame().

This partially reverts 8c1b2d5.

https://bugzilla.gnome.org/show_bug.cgi?id=675254

Gbp-Pq: Name 00_meta_window_move_frame-fix-crash-when-frame-is-NULL.patch

src/core/window.c

index 204bc0c65f24d263a4fa5fdd9fb1518a434c4c1d..9e4b93ca55f6e9e9b11ff54ebec68908ab65226f 100644 (file)
@@ -5108,18 +5108,20 @@ meta_window_move_frame (MetaWindow  *window,
 {
   int x = root_x_nw;
   int y = root_y_nw;
-  MetaFrameBorders borders;
-
-  meta_frame_calc_borders (window->frame, &borders);
 
-  /* root_x_nw and root_y_nw correspond to where the top of
-   * the visible frame should be. Offset by the distance between
-   * the origin of the window and the origin of the enclosing
-   * window decorations.
-   */
-  x += window->frame->child_x - borders.invisible.left;
-  y += window->frame->child_y - borders.invisible.top;
+  if (window->frame)
+    {
+      MetaFrameBorders borders;
+      meta_frame_calc_borders (window->frame, &borders);
 
+      /* root_x_nw and root_y_nw correspond to where the top of
+       * the visible frame should be. Offset by the distance between
+       * the origin of the window and the origin of the enclosing
+       * window decorations.
+       */
+      x += window->frame->child_x - borders.invisible.left;
+      y += window->frame->child_y - borders.invisible.top;
+    }
   meta_window_move (window, user_op, x, y);
 }