diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-01-30 22:54:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-01-30 22:54:38 +0100 |
| commit | ea6b2dae46caa1da829fbf499e83cd6ae3b3773a (patch) | |
| tree | f8f978b762fad664a4c8d5fdc11d8c7145ee09a8 /src/wx/gl_video_view.cc | |
| parent | a1546fb6c4e59621d99271b8ca996e96a574f7b3 (diff) | |
Various thread cleanups.
Diffstat (limited to 'src/wx/gl_video_view.cc')
| -rw-r--r-- | src/wx/gl_video_view.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index d47ad87f4..ebf4098e4 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); } @@ -386,7 +388,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)); } } |
