Fix a couple more crashes with incorrect KDMs (#1000).
[dcpomatic.git] / src / lib / encode_server.cc
index acb0be1c372b059f7bc87001819510cd4320f150..7bef82b2658c6b0b0e973b70b2e778593a7ed834 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -34,6 +34,7 @@
 #include "compose.hpp"
 #include "log.h"
 #include "encoded_log_entry.h"
+#include "version.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
@@ -94,8 +95,9 @@ EncodeServer::~EncodeServer ()
                delete i;
        }
 
-       _broadcast.socket->close ();
-       delete _broadcast.socket;
+       if (_broadcast.socket) {
+               _broadcast.socket->close ();
+       }
        _broadcast.io_service.stop ();
        if (_broadcast.thread) {
                /* Ideally this would be a DCPOMATIC_ASSERT(_broadcast.thread->joinable()) but we
@@ -221,7 +223,7 @@ EncodeServer::worker_thread ()
 void
 EncodeServer::run ()
 {
-       LOG_GENERAL ("Server starting with %1 threads", _num_threads);
+       LOG_GENERAL ("Server %1 (%2) starting with %3 threads", dcpomatic_version, dcpomatic_git_commit, _num_threads);
        if (_verbose) {
                cout << "DCP-o-matic server starting with " << _num_threads << " threads.\n";
        }