summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-11-20 00:50:58 +0100
committerCarl Hetherington <cth@carlh.net>2020-01-08 21:56:47 +0100
commit92caaad24055ad3517b974d19416091a98da4cf2 (patch)
treea8f13dd418511c26d1c2ac02cbe1e2d2688e72d6 /src
parent8993f85b88d6540d32709de704bc2fbcd3bf1d59 (diff)
Start thread when the window will have been created. Fix logic error.
Diffstat (limited to 'src')
-rw-r--r--src/wx/gl_video_view.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc
index 3549cfe8f..236b40518 100644
--- a/src/wx/gl_video_view.cc
+++ b/src/wx/gl_video_view.cc
@@ -54,6 +54,7 @@ using boost::optional;
GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
: VideoView (viewer)
, _vsync_enabled (false)
+ , _thread (0)
, _playing (false)
, _one_shot (false)
{
@@ -92,8 +93,6 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
glGenTextures (1, &_id);
glBindTexture (GL_TEXTURE_2D, _id);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
- _thread = new boost::thread (boost::bind(&GLVideoView::thread, this));
}
GLVideoView::~GLVideoView ()
@@ -264,6 +263,10 @@ GLVideoView::set_image (shared_ptr<const Image> image)
void
GLVideoView::start ()
{
+ if (!_thread) {
+ _thread = new boost::thread (boost::bind(&GLVideoView::thread, this));
+ }
+
boost::mutex::scoped_lock lm (_playing_mutex);
_playing = true;
_playing_condition.notify_all ();
@@ -288,7 +291,7 @@ try
while (true) {
boost::mutex::scoped_lock lm (_playing_mutex);
- while (!_playing || !_one_shot) {
+ while (!_playing && !_one_shot) {
_playing_condition.wait (lm);
}
_one_shot = false;