Fix segmentation fault on reload with pre-load hook
We need to manually force a reinitialization of the todo item list box before reloading the items. Otherwise, the list box contains dangling references to the linked list of todo items which has already been cleared at this point. After the pre-load hook is called, the windows are redrawn by wins_unprepare_external() and these invalid references are accessed, leading to a segmentation fault. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
8
src/io.c
8
src/io.c
@@ -857,6 +857,14 @@ void io_reload_data(void)
|
||||
recur_event_llist_init();
|
||||
todo_init_list();
|
||||
|
||||
/*
|
||||
* Temporarily reinitialize the todo list box without any items to make
|
||||
* sure wins_unprepare_external() does not fail when it is called after
|
||||
* executing the pre-load hook.
|
||||
*/
|
||||
ui_todo_load_items();
|
||||
ui_todo_sel_reset();
|
||||
|
||||
io_load_data(NULL);
|
||||
io_unset_modified();
|
||||
ui_todo_load_items();
|
||||
|
||||
Reference in New Issue
Block a user