Don't react so strongly to failure to bind the play server socket when starting a...
authorCarl Hetherington <cth@carlh.net>
Sun, 23 May 2021 21:04:46 +0000 (23:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 23 May 2021 21:04:46 +0000 (23:04 +0200)
src/tools/dcpomatic_player.cc

index c0587ed5557efcf64ec9acf48871e7fa6f422065..112f2c0654b463ef711d414188a7cf9605f7fdac 100644 (file)
@@ -1150,8 +1150,15 @@ private:
                        }
                        _frame->Show ();
 
-                       PlayServer* server = new PlayServer (_frame);
-                       new thread (boost::bind (&PlayServer::run, server));
+                       try {
+                               auto server = new PlayServer (_frame);
+                               new thread (boost::bind (&PlayServer::run, server));
+                       } catch (std::exception& e) {
+                               /* This is not the end of the world; probably a failure to bind the server socket
+                                * because there's already another player running.
+                                */
+                               LOG_DEBUG_PLAYER ("Failed to start play server (%1)", e.what());
+                       }
 
                        if (!_dcp_to_load.empty() && boost::filesystem::is_directory (_dcp_to_load)) {
                                try {