From 34fe81fabdb9aa06848a0179b00f5d61420d22e7 Mon Sep 17 00:00:00 2001 From: Thomas Thurman Date: Mon, 14 Jul 2008 00:41:25 +0000 Subject: [PATCH] meta_display_screen_for_root() can return NULL, so check for that. Fixes 2008-07-13 Thomas Thurman * src/core/display.c (event_callback): meta_display_screen_for_root() can return NULL, so check for that. Fixes #422242. Also tidying. svn path=/trunk/; revision=3788 --- ChangeLog | 5 +++++ src/core/display.c | 27 ++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2b440248..b84d888d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-13 Thomas Thurman + + * src/core/display.c (event_callback): meta_display_screen_for_root() + can return NULL, so check for that. Fixes #422242. Also tidying. + 2008-07-13 Elijah Newren * src/core/workspace.c (meta_workspace_free): Don't attempt to diff --git a/src/core/display.c b/src/core/display.c index 613230ff7..d6c44d103 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1910,11 +1910,13 @@ event_callback (XEvent *event, meta_event_mode_to_string (event->xfocus.mode), meta_event_detail_to_string (event->xfocus.detail)); } - else if (meta_display_screen_for_root (display, - event->xany.window) != NULL) + else { - MetaScreen * screen; - screen = meta_display_screen_for_root (display, event->xany.window); + MetaScreen *screen = + meta_display_screen_for_root(display, + event->xany.window); + if (screen == NULL) + break; meta_topic (META_DEBUG_FOCUS, "Focus %s event received on root window 0x%lx " @@ -1930,17 +1932,24 @@ event_callback (XEvent *event, event->xfocus.detail == NotifyDetailNone) { meta_topic (META_DEBUG_FOCUS, - "Focus got set to None, probably due to brain-damage in the X protocol (see bug 125492). Setting the default focus window.\n"); - - meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display)); + "Focus got set to None, probably due to " + "brain-damage in the X protocol (see bug " + "125492). Setting the default focus window.\n"); + meta_workspace_focus_default_window (screen->active_workspace, + NULL, + meta_display_get_current_time_roundtrip (display)); } else if (event->type == FocusIn && event->xfocus.mode == NotifyNormal && event->xfocus.detail == NotifyInferior) { meta_topic (META_DEBUG_FOCUS, - "Focus got set to root window, probably due to gnome-session logout dialog usage (see bug 153220). Setting the default focus window.\n"); - meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display)); + "Focus got set to root window, probably due to " + "gnome-session logout dialog usage (see bug " + "153220). Setting the default focus window.\n"); + meta_workspace_focus_default_window (screen->active_workspace, + NULL, + meta_display_get_current_time_roundtrip (display)); } }