Check if the frame exists before reading its size

This fixes crashes caused by popup windows that don't have override_redirect
(e.g., menus in VLC and KDE apps).

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Dima Ryazanov 2013-11-15 02:02:23 -08:00 committed by Kristian Høgsberg
parent b03b87fe63
commit cae1f0ff2d

View File

@ -497,7 +497,7 @@ weston_wm_window_get_frame_size(struct weston_wm_window *window,
if (window->fullscreen) { if (window->fullscreen) {
*width = window->width; *width = window->width;
*height = window->height; *height = window->height;
} else if (window->decorate) { } else if (window->decorate && window->frame) {
*width = frame_width(window->frame); *width = frame_width(window->frame);
*height = frame_height(window->frame); *height = frame_height(window->frame);
} else { } else {
@ -515,7 +515,7 @@ weston_wm_window_get_child_position(struct weston_wm_window *window,
if (window->fullscreen) { if (window->fullscreen) {
*x = 0; *x = 0;
*y = 0; *y = 0;
} else if (window->decorate) { } else if (window->decorate && window->frame) {
frame_interior(window->frame, x, y, NULL, NULL); frame_interior(window->frame, x, y, NULL, NULL);
} else { } else {
*x = t->margin; *x = t->margin;