summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2024-03-21 11:30:42 +0000
committernicm <nicm>2024-03-21 11:30:42 +0000
commit6c0067c10360880334afa50815b880d04edcbf42 (patch)
tree78625f90a92275f9de0cbdda102d5526a82302c9 /window.c
parent5458cb28502dbdce933827853c31b276b51f3741 (diff)
Do not notify window-layout-changed if the window is about to be
destroyed (since it may have been freed by the time the notify happens), from Romain Francoise in GitHub issue 3860.
Diffstat (limited to 'window.c')
-rw-r--r--window.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/window.c b/window.c
index c5d00e29..43c272bc 100644
--- a/window.c
+++ b/window.c
@@ -340,7 +340,7 @@ window_destroy(struct window *w)
{
log_debug("window @%u destroyed (%d references)", w->id, w->references);
- window_unzoom(w);
+ window_unzoom(w, 0);
RB_REMOVE(windows, &windows, w);
if (w->layout_root != NULL)
@@ -666,7 +666,7 @@ window_zoom(struct window_pane *wp)
}
int
-window_unzoom(struct window *w)
+window_unzoom(struct window *w, int notify)
{
struct window_pane *wp;
@@ -683,7 +683,9 @@ window_unzoom(struct window *w)
wp->saved_layout_cell = NULL;
}
layout_fix_panes(w, NULL);
- notify_window("window-layout-changed", w);
+
+ if (notify)
+ notify_window("window-layout-changed", w);
return (0);
}
@@ -697,7 +699,7 @@ window_push_zoom(struct window *w, int always, int flag)
w->flags |= WINDOW_WASZOOMED;
else
w->flags &= ~WINDOW_WASZOOMED;
- return (window_unzoom(w) == 0);
+ return (window_unzoom(w, 1) == 0);
}
int