diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-09 19:27:32 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-13 00:23:46 +0200 |
| commit | 06d773174378a70289bee8d7abb62e67deaaddf8 (patch) | |
| tree | 17f635a97679448eba9ae8a0b3e9d205fcbfa254 /src | |
| parent | 350afcbc40fffd8c8780180e153a2ee91088f562 (diff) | |
Do the right thing when the user cancels the unmount dialogue.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_disk.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index 6dbfbe4b0..ba92cf94e 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -171,24 +171,26 @@ private: TryUnmountDialog* d = new TryUnmountDialog(this, drive.description()); int const r = d->ShowModal (); d->Destroy (); - if (r == wxID_OK) { - if (!_nanomsg.send(DISK_WRITER_UNMOUNT "\n", 2000)) { - throw CommunicationFailedError (); - } - if (!_nanomsg.send(drive.internal_name() + "\n", 2000)) { - throw CommunicationFailedError (); - } - optional<string> reply = _nanomsg.receive (2000); - if (!reply || *reply != DISK_WRITER_OK) { - MessageDialog* m = new MessageDialog ( - this, - _("DCP-o-matic Disk Writer"), - wxString::Format(_("The drive %s could not be unmounted.\nClose any application that is using it, then try again."), std_to_wx(drive.description())) - ); - m->ShowModal (); - m->Destroy (); - return; - } + if (r != wxID_OK) { + return; + } + + if (!_nanomsg.send(DISK_WRITER_UNMOUNT "\n", 2000)) { + throw CommunicationFailedError (); + } + if (!_nanomsg.send(drive.internal_name() + "\n", 2000)) { + throw CommunicationFailedError (); + } + optional<string> reply = _nanomsg.receive (2000); + if (!reply || *reply != DISK_WRITER_OK) { + MessageDialog* m = new MessageDialog ( + this, + _("DCP-o-matic Disk Writer"), + wxString::Format(_("The drive %s could not be unmounted.\nClose any application that is using it, then try again."), std_to_wx(drive.description())) + ); + m->ShowModal (); + m->Destroy (); + return; } } |
