Tidy ownership/lifetime of GLVideoView to fix crashes on close.
[dcpomatic.git] / src / wx / standard_controls.cc
index 1e4ecc8d7fc74e5469c76759272110d209f42f1d..6196c1b5c29e10c39fcb55277a7e833116d7cf3c 100644 (file)
@@ -63,14 +63,15 @@ StandardControls::play_clicked ()
 void
 StandardControls::check_play_state ()
 {
-       if (!_film || _film->video_frame_rate() == 0) {
+       auto viewer = _viewer.lock ();
+       if (!_film || _film->video_frame_rate() == 0 || !viewer) {
                return;
        }
 
        if (_play_button->GetValue()) {
-               _viewer->start ();
+               viewer->start ();
        } else {
-               _viewer->stop ();
+               viewer->stop ();
        }
 }