Do the right thing when the user cancels the unmount dialogue.
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Apr 2020 17:27:32 +0000 (19:27 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Apr 2020 22:23:46 +0000 (00:23 +0200)
src/tools/dcpomatic_disk.cc

index 6dbfbe4b036791565092179ed59db5d13758b44e..ba92cf94e808cbb4133fc2eadabfddecf5c655fe 100644 (file)
@@ -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;
                        }
                }