Found by inspection, needs to be checked.
Both the plain C file IO and GIO (g_file_replace_contents) can leave the original file damaged if a failure occurs during a write. The normal advice is to "don't panic, you still have the buffer contents to save somewhere else", but if the save fails during a close Geany will still close, so now both the original file and the buffer are lost.
Basically `libmain.c` in `main_quit` should not ignore the return from `document_close_all()`.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147
I don't see it. `main_quit()` calls `document_account_for_unsaved()`, which itself uses `dialogs_show_unsaved_file()`, that properly return the value of `document_save_file()` if asked to save the file. What's wrong here?
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#issuecomment-234720441
But it doesn't abort the close AFAICT
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#issuecomment-234720505
/* Returns false when quitting is aborted due to user cancellation */ gboolean main_quit(void) { main_status.quitting = TRUE;
if (! check_no_unsaved()) // if there are some unsaved files { if (document_account_for_unsaved()) // if saving them was successfully dealt with { do_main_quit(); // quit! return TRUE; } } /* […] */
// abort quit main_status.quitting = FALSE; return FALSE; }
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#issuecomment-234720688
ahhh, I'm confusing `main_quit()` and `do_main_quit()`, stupid Geany spaghetti late at night.
Thats a relief :smile:
Slightly OT, looking at `main_quit()` it appears that if there are unsaved files the user is never asked to confirm the quit?
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#issuecomment-234749636
Closed #1147.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#event-732678418
Slightly OT, looking at `main_quit()` it appears that if there are unsaved files the user is never asked to confirm the quit?
No, but IMO it makes sense: if you're asked whether you want to save files because you're quitting, you can cancel instead, no need for a second dialog.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/1147#issuecomment-234750837
github-comments@lists.geany.org