From 06d773174378a70289bee8d7abb62e67deaaddf8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 9 Apr 2020 19:27:32 +0200 Subject: Do the right thing when the user cancels the unmount dialogue. --- src/tools/dcpomatic_disk.cc | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src') 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 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 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; } } -- cgit v1.2.3