desktop: don't hand an open Save dialog to another file

Some save requests open the Save dialog only after a wait: a file
opened when its download finishes, a file fetched from a linked mobile,
the database export. If a Save dialog was already open for another
file, such a request replaced the first one's result: the open dialog,
still showing the first file's name, saved the second file's content
under it, and the first request never completed.

A save request while a Save dialog is open now completes as cancelled.
The chooser is modal, so only a delayed request can arrive meanwhile.
This commit is contained in:
Narasimha-sc committed 2026-10-18 10:49:58 +00:00
1 parent 5a5a927821
commit 3fc8c6992b
1 file changed
+1
@@ -75,6 +75,7 @@ actual class FileChooserLauncher actual constructor() {
)
res = simplexWindowState.openDialog.awaitResult(params)
} else {
if (simplexWindowState.saveDialog.isAwaiting) return onResult(null)
res = simplexWindowState.saveDialog.awaitResult(DialogParams(filename = input))
if (res != null && res.isDirectory) {
res = File(res, input)