Skip to content

Commit

Permalink
Disable QUIT while saving a file
Browse files Browse the repository at this point in the history
The problem is that if you are fast enough to do Ctrl-S and Ctrl-Q (and
the save is slow) the Quit action was executed before the Save finished.
The Save function modifies some GUI status but the window was already
closed because of Quit. And we get a crash.

Now the Quit action is ignored while a Save or Save-as is executing.

Fixes bug #1969
http://www.grisbi.org/bugsreports/view.php?id=1969
  • Loading branch information
LudovicRousseau committed Sep 7, 2019
1 parent 3a94d45 commit cf0ca19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/grisbi_app.c
Expand Up @@ -299,6 +299,10 @@ static void grisbi_app_quit (GSimpleAction *action,

app = GRISBI_APP (user_data);

/* do not exit while saving. See bug #1969 */
if (run.menu_save)
return;

/* Remove all windows registered in the application */
while ((l = gtk_application_get_windows (GTK_APPLICATION (app))))
{
Expand Down
5 changes: 5 additions & 0 deletions src/menu.c
Expand Up @@ -444,7 +444,10 @@ void grisbi_cmd_file_save (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
/* disable quit. See bug #1969 */
run.menu_save = TRUE;
gsb_file_save ();
run.menu_save = FALSE;
}

/**
Expand All @@ -460,7 +463,9 @@ void grisbi_cmd_file_save_as (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
run.menu_save = TRUE;
gsb_file_save_as ();
run.menu_save = FALSE;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/structures.h
Expand Up @@ -313,6 +313,7 @@ struct _GrisbiWinRun
time_t file_modification;
gboolean file_is_saving;
gboolean file_is_loading;
gboolean menu_save;

/* reconciliation */
gint equilibrage;
Expand Down

0 comments on commit cf0ca19

Please sign in to comment.