Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 797900 - Crash caused by Quitting while Check and Repair All is r…
…unning The account tree page didn't have a "finish" function normally used to verify a page can close. I added one, along with two flags that indicate whether a scrubbing operation is currently ongoing and whether we should quit when the scrubbing is done. The result is: If a user attempts to quit while scrubbing isn't done, an alert pops up asking whether the user wants to abort the scrub. If so, the scrub is aborted (safely) and GC quits. If not the app does not quit. I have to say, I'm not sure this is the right way to do this. In my view, the right way would be: - Disable the "quit" menu when scrubbing is happening (for some reason gnc_suspend_gui_refresh() does not cause the quit menu to be grayed) so there's no chance of quitting while scrubbing is ongoing - If needed, add an abort scrubbing button to the main window. Not sure whether that's desirable or not. Let me know what you think: is what I have what we need, or would the above be better.
- Loading branch information
1 parent
a50c188
commit bbdd4f3
Showing
5 changed files
with
109 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,6 +413,30 @@ gnc_plugin_page_account_tree_new (void) | |
|
||
G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageAccountTree, gnc_plugin_page_account_tree, GNC_TYPE_PLUGIN_PAGE) | ||
|
||
static void | ||
prepare_scrubbing () | ||
{ | ||
gnc_suspend_gui_refresh (); | ||
gnc_set_abort_scrub (FALSE); | ||
} | ||
|
||
static gboolean | ||
finish (GncPluginPage* page) | ||
{ | ||
if (gnc_get_ongoing_scrub ()) | ||
{ | ||
gboolean ret = gnc_verify_dialog (NULL, FALSE, "%s", "A scrubbing operation is currently pending, do you want to abort it?"); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jralls
Member
|
||
if (ret) | ||
{ | ||
gnc_set_abort_scrub (TRUE); | ||
gnc_resume_gui_refresh (); // This is so quit does not complain about an ongoing operation. | ||
return TRUE; | ||
} | ||
return FALSE; | ||
} | ||
return TRUE; | ||
} | ||
|
||
static void | ||
gnc_plugin_page_account_tree_class_init (GncPluginPageAccountTreeClass *klass) | ||
{ | ||
|
@@ -430,6 +454,8 @@ gnc_plugin_page_account_tree_class_init (GncPluginPageAccountTreeClass *klass) | |
gnc_plugin_class->save_page = gnc_plugin_page_account_tree_save_page; | ||
gnc_plugin_class->recreate_page = gnc_plugin_page_account_tree_recreate_page; | ||
gnc_plugin_class->focus_page_function = gnc_plugin_page_account_tree_focus_widget; | ||
gnc_plugin_class->finish_pending = finish; | ||
|
||
|
||
plugin_page_signals[ACCOUNT_SELECTED] = | ||
g_signal_new ("account_selected", | ||
|
@@ -1913,7 +1939,7 @@ gnc_plugin_page_account_tree_cmd_scrub (GtkAction *action, GncPluginPageAccountT | |
|
||
g_return_if_fail (account != NULL); | ||
|
||
gnc_suspend_gui_refresh (); | ||
prepare_scrubbing (); | ||
|
||
window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window); | ||
gnc_window_set_progressbar_window (window); | ||
|
@@ -1939,7 +1965,7 @@ gnc_plugin_page_account_tree_cmd_scrub_sub (GtkAction *action, GncPluginPageAcco | |
|
||
g_return_if_fail (account != NULL); | ||
|
||
gnc_suspend_gui_refresh (); | ||
prepare_scrubbing (); | ||
|
||
window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window); | ||
gnc_window_set_progressbar_window (window); | ||
|
@@ -1962,7 +1988,7 @@ gnc_plugin_page_account_tree_cmd_scrub_all (GtkAction *action, GncPluginPageAcco | |
Account *root = gnc_get_current_root_account (); | ||
GncWindow *window; | ||
|
||
gnc_suspend_gui_refresh (); | ||
prepare_scrubbing (); | ||
|
||
window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window); | ||
gnc_window_set_progressbar_window (window); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
They need the
gnc_verify_dialog
to select the parent window properly, although I am not entirely sure why: