X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fgl_video_view.cc;h=0e4bcb671b88cfbebdba84ac0fe55a6b42169fe8;hb=fc18b92ca1cc8d7ec975fddc507fb97aacc6d17f;hp=d47ad87f48cdfbe788bd9151d04920c7cd5bb0ac;hpb=4f0575fcb518d959e8dcf581ec8181609782b4ef;p=dcpomatic.git diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index d47ad87f4..0e4bcb671 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -57,7 +57,6 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent) : VideoView (viewer) , _have_storage (false) , _vsync_enabled (false) - , _thread (0) , _playing (false) , _one_shot (false) { @@ -105,9 +104,12 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent) GLVideoView::~GLVideoView () { - _thread->interrupt (); - _thread->join (); - delete _thread; + try { + _thread.interrupt (); + _thread.join (); + } catch (...) { + + } glDeleteTextures (1, &_id); } @@ -115,6 +117,10 @@ GLVideoView::~GLVideoView () void GLVideoView::check_for_butler_errors () { + if (!_viewer->butler()) { + return; + } + try { _viewer->butler()->rethrow (); } catch (DecodeError& e) { @@ -386,7 +392,7 @@ GLVideoView::request_one_shot () void GLVideoView::create () { - if (!_thread) { - _thread = new boost::thread (boost::bind(&GLVideoView::thread, this)); + if (!_thread.joinable()) { + _thread = boost::thread (boost::bind(&GLVideoView::thread, this)); } }