Use ScopeGuard for _no_check_selection
[dcpomatic.git] / src / wx / standard_controls.cc
index 6196c1b5c29e10c39fcb55277a7e833116d7cf3c..de63c2fce8da83ab32e74aa6708ff3eca3c07960 100644 (file)
 
 #include "film_viewer.h"
 #include "standard_controls.h"
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/tglbtn.h>
 #include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 
 
 using std::shared_ptr;
 
 
-StandardControls::StandardControls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
+StandardControls::StandardControls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
        : Controls (parent, viewer, editor_controls)
        , _play_button (new wxToggleButton(this, wxID_ANY, _("Play")))
 {
@@ -63,15 +66,14 @@ StandardControls::play_clicked ()
 void
 StandardControls::check_play_state ()
 {
-       auto viewer = _viewer.lock ();
-       if (!_film || _film->video_frame_rate() == 0 || !viewer) {
+       if (!_film || _film->video_frame_rate() == 0) {
                return;
        }
 
        if (_play_button->GetValue()) {
-               viewer->start ();
+               _viewer.start();
        } else {
-               viewer->stop ();
+               _viewer.stop();
        }
 }