diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-01-13 22:49:51 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-01-14 00:24:46 +0000 |
| commit | 97ce603137dace8e85fe72975644c220d7fa9ae8 (patch) | |
| tree | 41828939af011b0af8241e4bacf195d34035344e /src | |
| parent | 66ce3b83877b3d7b95f6cd424fc9516e0bf79aa9 (diff) | |
Fix crash when unsetting forced video frame rates in the timing panel.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content.cc | 12 | ||||
| -rw-r--r-- | src/lib/content.h | 1 | ||||
| -rw-r--r-- | src/wx/timing_panel.cc | 11 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 40f74fe9a..7b1e630a6 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -48,6 +48,7 @@ using std::vector; using std::max; using std::pair; using boost::shared_ptr; +using boost::optional; using dcp::raw_convert; using dcp::locale_convert; @@ -361,6 +362,17 @@ Content::set_video_frame_rate (double r) signal_changed (ContentProperty::VIDEO_FRAME_RATE); } +void +Content::unset_video_frame_rate () +{ + { + boost::mutex::scoped_lock lm (_mutex); + _video_frame_rate = optional<double>(); + } + + signal_changed (ContentProperty::VIDEO_FRAME_RATE); +} + double Content::active_video_frame_rate () const { diff --git a/src/lib/content.h b/src/lib/content.h index f0a2d0bdb..836a3bd77 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -166,6 +166,7 @@ public: } void set_video_frame_rate (double r); + void unset_video_frame_rate (); double active_video_frame_rate () const; diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index d7ed46f46..653e44669 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -409,9 +409,16 @@ TimingPanel::video_frame_rate_changed () void TimingPanel::set_video_frame_rate () { - double const fr = locale_convert<double> (wx_to_std (_video_frame_rate->GetValue ())); + optional<double> fr; + if (_video_frame_rate->GetValue() != wxT("")) { + fr = locale_convert<double> (wx_to_std (_video_frame_rate->GetValue ())); + } BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) { - i->set_video_frame_rate (fr); + if (fr) { + i->set_video_frame_rate (*fr); + } else { + i->unset_video_frame_rate (); + } } _set_video_frame_rate->Enable (false); |
