mirror of
https://github.com/swaywm/sway.git
synced 2026-02-05 04:06:25 -05:00
overview: clear fullscreen reference when destroying fullscreen container
When a fullscreen container is destroyed while in overview mode, the workspace layout may still keep a stale fullscreen pointer, leading to invalid memory access and crashes when exiting overview. This change clears the fullscreen reference if the destroyed container is the one stored in the overview layout, preventing use-after-free and crash scenarios.
This commit is contained in:
parent
40aabb80c6
commit
1a954e290d
1 changed files with 6 additions and 0 deletions
|
|
@ -538,6 +538,12 @@ void container_begin_destroy(struct sway_container *con) {
|
|||
if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE && con->pending.workspace) {
|
||||
con->pending.workspace->fullscreen = NULL;
|
||||
}
|
||||
|
||||
// If the container was the one stored in the overview's fullscreen memory, clear it.
|
||||
if (con->pending.workspace && con->pending.workspace->layout.fullscreen == con) {
|
||||
con->pending.workspace->layout.fullscreen = NULL;
|
||||
}
|
||||
|
||||
if (con->scratchpad && con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
|
||||
container_fullscreen_disable(con);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue