Fix crash if saving files during save/cancel/close (#2517).
authorCarl Hetherington <cth@carlh.net>
Tue, 18 Apr 2023 19:04:27 +0000 (21:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 18 Apr 2023 19:04:27 +0000 (21:04 +0200)
src/tools/dcpomatic.cc

index bd5be54aed3b19fe8987fb2ae0975a33be7bca9a..a7b3af8bce0999f44d4c420163988fccc72372ad 100644 (file)
@@ -1269,14 +1269,20 @@ private:
                        return true;
                }
 
-               if (_film->dirty ()) {
+               while (_film->dirty()) {
                        T dialog(_film->name());
                        switch (dialog.run()) {
                        case wxID_NO:
                                return true;
                        case wxID_YES:
-                               _film->write_metadata ();
-                               return true;
+                               try {
+                                       _film->write_metadata();
+                                       return true;
+                               } catch (exception& e) {
+                                       error_dialog(this, _("Could not save project."), std_to_wx(e.what()));
+                                       /* Go round again for another try */
+                               }
+                               break;
                        case wxID_CANCEL:
                                return false;
                        }