From 105c6eb2116ab5db0157b272a22243bba1ae50ef Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 20 Aug 2015 13:58:07 +0200 Subject: Fix crash when struts change during grab operation Since meta_workspace_invalidate_work_area() frees the edges workspace->screen_edges and workspace->monitor_edges, we must clean up our cached edge resistance data when the invalidate_work_area() is called on the active workspace, or when the workspace changes. Make the computation of the edge resistance data lazy so that it will be recomputed the next time we try to access it. meta_display_compute_resistance_and_snapping_edges() is made private to edge-resistance.c Invaliding the data when active workspace changes also will improve correctness for edge resistance when the current workspace changes during a grab operation. (Even with this fix we still don't try to handle window positions changing during a grab operation; that can't cause a crash since, unlike screen and monitor edges, the window edges are freshly allocated, it will just cause slight oddness in that corner case.) Root cause tracked down due to much effort by Jon Nettleton. https://bugzilla.gnome.org/show_bug.cgi?id=608800 --- src/core/workspace.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/workspace.c') diff --git a/src/core/workspace.c b/src/core/workspace.c index b85ab53c..928f3de6 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -382,6 +382,10 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, if (workspace->screen->active_workspace) workspace_switch_sound(workspace->screen->active_workspace, workspace); + /* Free any cached pointers to the workspaces's edges from + * a current resize or move operation */ + meta_display_cleanup_edges (workspace->screen->display); + /* Note that old can be NULL; e.g. when starting up */ old = workspace->screen->active_workspace; @@ -542,6 +546,11 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) "Invalidating work area for workspace %d\n", meta_workspace_index (workspace)); + /* If we are in the middle of a resize or move operation, we + * might have cached pointers to the workspace's edges */ + if (workspace == workspace->screen->active_workspace) + meta_display_cleanup_edges (workspace->screen->display); + g_free (workspace->work_area_xinerama); workspace->work_area_xinerama = NULL; -- cgit v1.2.1