Handle butler thread exceptions properly.
authorCarl Hetherington <cth@carlh.net>
Mon, 17 Apr 2017 23:07:07 +0000 (00:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Apr 2017 22:04:32 +0000 (23:04 +0100)
src/lib/butler.cc
src/lib/butler.h
src/wx/film_viewer.cc

index 7481b030118678d5c3806eb5d1b95a733d95bd81..81e09fbd3c27a54be39eb0b7c2328a420cda3e5c 100644 (file)
@@ -98,6 +98,8 @@ try
        }
 } catch (boost::thread_interrupted) {
        /* The butler thread is being terminated */
+} catch (...) {
+       store_current ();
 }
 
 pair<shared_ptr<PlayerVideo>, DCPTime>
index f483524482bddd86e324aebe5ed9e407f1439acf..101677558ab8128360d053548648a048e7b997b4 100644 (file)
@@ -21,6 +21,7 @@
 #include "video_ring_buffers.h"
 #include "audio_ring_buffers.h"
 #include "audio_mapping.h"
+#include "exception_store.h"
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
 #include <boost/thread.hpp>
@@ -31,7 +32,7 @@ class Film;
 class Player;
 class PlayerVideo;
 
-class Butler : public boost::noncopyable
+class Butler : public ExceptionStore, public boost::noncopyable
 {
 public:
        Butler (boost::weak_ptr<const Film> film, boost::shared_ptr<Player> player, AudioMapping map, int audio_channels);
index 588a27e011c9f64a0b4a15f93723e74bcefc5de8..fcaca297365b4f947909cc92608915f97cfb4210 100644 (file)
@@ -308,6 +308,10 @@ FilmViewer::timer ()
                DCPTime const next = now + DCPTime::from_frames (1, _film->video_frame_rate ());
                _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 0.0), wxTIMER_ONE_SHOT);
        }
+
+       if (_butler) {
+               _butler->rethrow ();
+       }
 }
 
 void