]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: fix crash when a minimized fullscreen window closes
authorbi4k8 <bi4k8@github>
Thu, 11 Jan 2024 14:56:04 +0000 (14:56 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 11 Jan 2024 20:56:47 +0000 (20:56 +0000)
Do not call view methods after invalidating an invariant of the view
(view->scene_tree != NULL)

src/view.c

index 68e24e2e154e2dc0869f446f307cf3849ea8a966..7ab09e2ddf46e594505b1135f494ece3fd0f745d 100644 (file)
@@ -2030,11 +2030,6 @@ view_destroy(struct view *view)
        osd_on_view_destroy(view);
        undecorate(view);
 
-       if (view->scene_tree) {
-               wlr_scene_node_destroy(&view->scene_tree->node);
-               view->scene_tree = NULL;
-       }
-
        /*
         * The layer-shell top-layer is disabled when an application is running
         * in fullscreen mode, so if that's the case, we may have to re-enable
@@ -2054,6 +2049,16 @@ view_destroy(struct view *view)
                menu_close_root(server);
        }
 
+       /*
+        * Destroy the view's scene tree. View methods assume this is non-NULL,
+        * so we should avoid any calls to those between this and freeing the
+        * view.
+        */
+       if (view->scene_tree) {
+               wlr_scene_node_destroy(&view->scene_tree->node);
+               view->scene_tree = NULL;
+       }
+
        /* Remove view from server->views */
        wl_list_remove(&view->link);
        free(view);