}
void
-Butler::prepare (weak_ptr<PlayerVideo> weak_video) const
+Butler::prepare (weak_ptr<PlayerVideo> weak_video)
+try
{
shared_ptr<PlayerVideo> video = weak_video.lock ();
/* If the weak_ptr cannot be locked the video obviously no longer requires any work */
LOG_TIMING("finish-prepare in %1", thread_id());
}
}
+catch (...)
+{
+ store_current ();
+ boost::mutex::scoped_lock lm (_mutex);
+ _died = true;
+}
void
Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
void audio (boost::shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate);
void text (PlayerText pt, TextType type, boost::optional<DCPTextTrack> track, DCPTimePeriod period);
bool should_run () const;
- void prepare (boost::weak_ptr<PlayerVideo> video) const;
+ void prepare (boost::weak_ptr<PlayerVideo> video);
void player_change (ChangeType type, bool frequent);
void seek_unlocked (DCPTime position, bool accurate);
#ifndef DCPOMATIC_SIGNAL_MANAGER_H
#define DCPOMATIC_SIGNAL_MANAGER_H
+#include "exception_store.h"
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/noncopyable.hpp>
/** A class to allow signals to be emitted from non-UI threads and handled
* by a UI thread.
*/
-class SignalManager : public boost::noncopyable
+class SignalManager : public boost::noncopyable, public ExceptionStore
{
public:
/** Create a SignalManager. Must be called from the UI thread */
void emit (T f) {
if (boost::this_thread::get_id() == _ui_thread) {
/* already in the UI thread */
- f ();
+ try {
+ f ();
+ } catch (...) {
+ store_current ();
+ }
} else {
/* non-UI thread; post to the service and wake up the UI */
_service.post (f);