diff --git a/src/core/window.c b/src/core/window.c index b9c07ec4f..1fc483d16 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2933,6 +2933,8 @@ meta_window_is_monitor_sized (MetaWindow *window) gboolean meta_window_is_on_primary_monitor (MetaWindow *window) { + g_return_val_if_fail (window->monitor, FALSE); + return window->monitor->is_primary; } @@ -4543,13 +4545,22 @@ set_workspace_state (MetaWindow *window, static gboolean should_be_on_all_workspaces (MetaWindow *window) { - return - window->always_sticky || - window->on_all_workspaces_requested || - window->override_redirect || - (meta_prefs_get_workspaces_only_on_primary () && - !window->unmanaging && - !meta_window_is_on_primary_monitor (window)); + if (window->always_sticky) + return TRUE; + + if (window->on_all_workspaces_requested) + return TRUE; + + if (window->override_redirect) + return TRUE; + + if (meta_prefs_get_workspaces_only_on_primary () && + !window->unmanaging && + window->monitor && + !meta_window_is_on_primary_monitor (window)) + return TRUE; + + return FALSE; } void