Call Button_Quit and Button_Page with correct enum

These functions are called explicitly in a few places and need to be
handed the corresponding enum value to correctly get the button value.
Since they were previously called with -1, they would cause segfaults.
These seemed to happen when restoring backups or loading images to both
pages.
This commit is contained in:
Philip Linde 2018-06-03 20:03:34 +00:00
parent 6a1f5e21ff
commit b91cfe4ed3
4 changed files with 5 additions and 5 deletions

View File

@ -679,7 +679,7 @@ void Button_Quit(int btn)
{ {
if (Spare.image_is_modified) if (Spare.image_is_modified)
{ {
Button_Page(btn); // On passe sur le brouillon Button_Page(BUTTON_PAGE); // On passe sur le brouillon
// Si l'utilisateur présente les derniers symptomes de l'abandon // Si l'utilisateur présente les derniers symptomes de l'abandon
if (Button_Quit_local_function()) if (Button_Quit_local_function())
Quitting=1; Quitting=1;
@ -691,7 +691,7 @@ void Button_Quit(int btn)
if ( (Menu_is_visible) && (Mouse_Y+8>Menu_Y) ) if ( (Menu_is_visible) && (Mouse_Y+8>Menu_Y) )
Hide_cursor(); Hide_cursor();
Unselect_button(BUTTON_QUIT); Unselect_button(btn);
if ( (Menu_is_visible) && (Mouse_Y+8>Menu_Y) ) if ( (Menu_is_visible) && (Mouse_Y+8>Menu_Y) )
Display_cursor(); Display_cursor();

View File

@ -730,7 +730,7 @@ void Main_handler(void)
if (Quit_is_required) if (Quit_is_required)
{ {
Quit_is_required=0; Quit_is_required=0;
Button_Quit(-1); Button_Quit(BUTTON_QUIT);
} }
if (Pan_shortcut_pressed && Current_operation!=OPERATION_PAN_VIEW) if (Pan_shortcut_pressed && Current_operation!=OPERATION_PAN_VIEW)

View File

@ -1588,7 +1588,7 @@ if (Create_lock_file(Config_directory))
Compute_limits(); Compute_limits();
Compute_paintbrush_coordinates(); Compute_paintbrush_coordinates();
if (Backups_main) if (Backups_main)
Button_Page(-1); Button_Page(BUTTON_PAGE);
} }
restored_main = Process_backups(&Backups_main); restored_main = Process_backups(&Backups_main);

View File

@ -969,7 +969,7 @@ int Init_program(int argc,char * argv[])
Redraw_layered_image(); Redraw_layered_image();
End_of_modification(); End_of_modification();
Button_Page(-1); Button_Page(BUTTON_PAGE);
// no break ! proceed with the other file now // no break ! proceed with the other file now
case 1: case 1:
Init_context_layered_image(&context, main_filename, main_directory); Init_context_layered_image(&context, main_filename, main_directory);