summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-01-30 22:54:38 +0100
committerCarl Hetherington <cth@carlh.net>2020-01-30 22:54:38 +0100
commitea6b2dae46caa1da829fbf499e83cd6ae3b3773a (patch)
treef8f978b762fad664a4c8d5fdc11d8c7145ee09a8 /src/wx
parenta1546fb6c4e59621d99271b8ca996e96a574f7b3 (diff)
Various thread cleanups.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/gl_video_view.cc14
-rw-r--r--src/wx/gl_video_view.h2
2 files changed, 9 insertions, 7 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));
}
}
diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h
index 2f3c8c2a1..84d97c751 100644
--- a/src/wx/gl_video_view.h
+++ b/src/wx/gl_video_view.h
@@ -68,7 +68,7 @@ private:
boost::optional<dcp::Size> _size;
bool _have_storage;
bool _vsync_enabled;
- boost::thread* _thread;
+ boost::thread _thread;
boost::mutex _playing_mutex;
boost::condition _playing_condition;