Fix crash when starting two batch converters at the same time.
authorCarl Hetherington <cth@carlh.net>
Sat, 24 Dec 2022 22:08:08 +0000 (23:08 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 24 Dec 2022 22:08:08 +0000 (23:08 +0100)
src/tools/dcpomatic_batch.cc

index dcda39fd8042c336a3302f293dcd5c21e69ea5e5..6e054edf8d8921b2b3793bfe4dcebe398f7d514a 100644 (file)
@@ -442,8 +442,12 @@ class App : public wxApp
                }
                _frame->Show ();
 
-               auto server = new JobServer (_frame);
-               new thread (boost::bind (&JobServer::run, server));
+               try {
+                       auto server = new JobServer (_frame);
+                       new thread (boost::bind (&JobServer::run, server));
+               } catch (boost::system::system_error& e) {
+                       error_dialog(_frame, _("Could not listen for new batch jobs.  Perhaps another instance of the DCP-o-matic Batch Converter is running."));
+               }
 
                signal_manager = new wxSignalManager (this);
                this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this));