Fixes #2599. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3388
-- Commit Summary --
* Fix #2599 - Save As dialog can save the wrong document
-- File Changes --
M src/dialogs.c (14)
-- Patch Links --
https://github.com/geany/geany/pull/3388.patch https://github.com/geany/geany/pull/3388.diff
LGBI
Ideally we would error when opening a file from the command line when there's a modal dialog open to prevent issues like this. I'm not sure if there's a way of detecting that without adding cases for each dialog.
There's still a case where Save As is used on the only empty new document, and the command line file replaces that document while the dialog is still open. But this fixes the other cases.
Well, in that unlikely situation all that is lost is a blank file so its ok, just confusing if the newly opened file is saved as/renamed.
This fix is superceded by #3395, but it's probably worth merging this also for resilience.
Tested and works great. I agree that even with #3395, this cannot hurt. There might be more cases where the current doc differs from the doc the Save As dialog were open.
Merged #3388 into master.
github-comments@lists.geany.org