Fix crash on hotkey-opening the menu then pressing right a few times.
[dcpomatic.git] / src / lib / encode_server.cc
index d31760c0d975686757df88acc4469baa897956a2..314f8f68dcccda973d04ac683064fc2f25dec6de 100644 (file)
@@ -313,10 +313,12 @@ EncodeServer::broadcast_received ()
        }
 
        boost::mutex::scoped_lock lm (_broadcast.mutex);
-       _broadcast.socket->async_receive_from (
-               boost::asio::buffer (_broadcast.buffer, sizeof (_broadcast.buffer)),
-               _broadcast.send_endpoint, boost::bind (&EncodeServer::broadcast_received, this)
-               );
+       if (_broadcast.socket) {
+               _broadcast.socket->async_receive_from (
+                       boost::asio::buffer (_broadcast.buffer, sizeof (_broadcast.buffer)),
+                       _broadcast.send_endpoint, boost::bind (&EncodeServer::broadcast_received, this)
+                       );
+       }
 }
 
 void
@@ -324,6 +326,9 @@ EncodeServer::handle (shared_ptr<Socket> socket)
 {
        boost::mutex::scoped_lock lock (_mutex);
 
+       Waker waker;
+       waker.nudge ();
+
        /* Wait until the queue has gone down a bit */
        while (_queue.size() >= _worker_threads.size() * 2 && !_terminate) {
                _full_condition.wait (lock);