[BUG] Windows code ignores cancel on open/save dialogs.
Closed this issue · 1 comments
rj45 commented
The return value of the following functions is ignored, which is a BOOL indicating if the ok button was pressed, or cancel/close:
nvdialog/src/backend/win32/nvdialog_file_dialog.c
Lines 104 to 105 in c35acb9
I fixed it like this, but you may want to do it differently:
if (dialog->is_save_dialog)
dialog->location_was_chosen = GetSaveFileName(&ofn);
else
dialog->location_was_chosen = GetOpenFileName(&ofn);
I then check dialog->location_was_chosen
before I strdup()
the string and return it. That way the string doesn't need to be freed if dialog->location_was_chosen
is false.
tseli0s commented
That fix seems fine, make a pull request and I'll merge it.