Fix window update after hook execution
The introduction of hooks raised a problem with window updates. The diagnosis in commit feb059e8 (Fix segmentation fault on reload with pre-load hook) was right, the cure was wrong. The problem is wins_update(), not the listbox contents. The wins_update() call does not belong in wins_unprepare_external() (or in io_reload_data()), but at a higher level. It should be called _after_ reload, as indeed it is in key_generic_reload() when the listbox contents have been updated (todo as well as appointments). The call was introduced in commit 8ae75f3 without comment. The todo updates in io_reload_data() also belong in key_generic_reload() where they were before commit 7f06c252. When saving data, all panels must be updated in case a hook was executed. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
37d8725e78
commit
a94b0ecde0
@ -272,17 +272,19 @@ static inline void key_generic_help(void)
|
|||||||
static inline void key_generic_save(void)
|
static inline void key_generic_save(void)
|
||||||
{
|
{
|
||||||
io_save_cal(IO_SAVE_DISPLAY_BAR);
|
io_save_cal(IO_SAVE_DISPLAY_BAR);
|
||||||
wins_update(FLAG_STA);
|
wins_update(FLAG_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void key_generic_reload(void)
|
static inline void key_generic_reload(void)
|
||||||
{
|
{
|
||||||
if (io_reload_data()) {
|
if (io_reload_data()) {
|
||||||
|
ui_todo_load_items();
|
||||||
|
ui_todo_sel_reset();
|
||||||
do_storage(0);
|
do_storage(0);
|
||||||
notify_check_next_app(1);
|
notify_check_next_app(1);
|
||||||
ui_calendar_monthly_view_cache_set_invalid();
|
ui_calendar_monthly_view_cache_set_invalid();
|
||||||
wins_update(FLAG_ALL);
|
|
||||||
}
|
}
|
||||||
|
wins_update(FLAG_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void key_generic_import(void)
|
static inline void key_generic_import(void)
|
||||||
|
11
src/io.c
11
src/io.c
@ -935,7 +935,6 @@ int io_reload_data(void)
|
|||||||
case 3:
|
case 3:
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
wins_update(FLAG_STA);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -961,20 +960,10 @@ int io_reload_data(void)
|
|||||||
recur_event_llist_init();
|
recur_event_llist_init();
|
||||||
todo_init_list();
|
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_load_data(NULL);
|
||||||
run_hook("post-load");
|
run_hook("post-load");
|
||||||
|
|
||||||
io_unset_modified();
|
io_unset_modified();
|
||||||
ui_todo_load_items();
|
|
||||||
ui_todo_sel_reset();
|
|
||||||
|
|
||||||
if (show_dialogs()) {
|
if (show_dialogs()) {
|
||||||
status_mesg(reload_success, enter);
|
status_mesg(reload_success, enter);
|
||||||
|
@ -613,7 +613,6 @@ void wins_unprepare_external(void)
|
|||||||
ui_mode = UI_CURSES;
|
ui_mode = UI_CURSES;
|
||||||
wins_refresh();
|
wins_refresh();
|
||||||
wins_resize();
|
wins_resize();
|
||||||
wins_update(FLAG_ALL);
|
|
||||||
if (notify_bar())
|
if (notify_bar())
|
||||||
notify_start_main_thread();
|
notify_start_main_thread();
|
||||||
if (conf.periodic_save > 0)
|
if (conf.periodic_save > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user