Fix recently-introduced crash on double-terminating the Writer thread.
authorCarl Hetherington <cth@carlh.net>
Sun, 12 Jan 2014 23:44:31 +0000 (23:44 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Jan 2014 23:44:31 +0000 (23:44 +0000)
src/lib/writer.cc

index 572a1c3a462d1ffa3f117b6b56378f82ae8435dc..7fd7464885303c5348df3d92b11a87ee9c0ebe65 100644 (file)
@@ -344,6 +344,10 @@ void
 Writer::terminate_thread (bool can_throw)
 {
        boost::mutex::scoped_lock lock (_mutex);
+       if (_thread == 0) {
+               return;
+       }
+       
        _finish = true;
        _empty_condition.notify_all ();
        _full_condition.notify_all ();