Only handle MAM response if window still exists

Before this patch the following scenario lead to a segfault:
1. open a window that sends a MAM request
2. fast enough close that window again before the MAM response was
   processed
Once the MAM response is received we'd call `_mam_rsm_id_handler()`
from the `_iq_handler()` and `window` would point to a non-existant window
which leads to a segfault.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel
2023-11-16 13:19:28 +01:00
parent 2b51675e89
commit c3ed0c3262
3 changed files with 55 additions and 0 deletions

View File

@@ -712,6 +712,8 @@ ui_close_win(int index)
}
}
// remove the IQ handlers
iq_handlers_remove_win(window);
wins_close_by_num(index);
title_bar_console();
status_bar_current(1);