diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-28 00:13:54 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-28 00:13:54 +0000 |
| commit | 3c88c626399fff9b95c89065d3b8ee9de1148d52 (patch) | |
| tree | e6091d94a746d1aad71d2d46b9736acf89d82fdd /src/wx | |
| parent | f508191f9d794e7762270d19a4211739470cfe0d (diff) | |
Fix crash if quick_refresh() fails.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_viewer.cc | 26 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 2 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 11505e510..ade45d766 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -446,7 +446,9 @@ FilmViewer::panel_sized (wxSizeEvent& ev) _panel_size.height = ev.GetSize().GetHeight(); calculate_sizes (); - quick_refresh (); + if (!quick_refresh()) { + slow_refresh (); + } update_position_label (); update_position_slider (); } @@ -639,6 +641,7 @@ FilmViewer::player_changed (int property, bool frequent) } calculate_sizes (); + bool refreshed = false; if ( property == VideoContentProperty::CROP || property == VideoContentProperty::SCALE || @@ -648,8 +651,10 @@ FilmViewer::player_changed (int property, bool frequent) property == PlayerProperty::VIDEO_CONTAINER_SIZE || property == PlayerProperty::FILM_CONTAINER ) { - quick_refresh (); - } else { + refreshed = quick_refresh (); + } + + if (!refreshed) { slow_refresh (); } update_position_label (); @@ -696,16 +701,23 @@ FilmViewer::slow_refresh () seek (_video_position, true); } -/** Re-get the current frame quickly by resetting the metadata in the PlayerVideo that we used last time */ -void +/** Try to re-get the current frame quickly by resetting the metadata + * in the PlayerVideo that we used last time. + * @return true if this was possible, false if not. + */ +bool FilmViewer::quick_refresh () { if (!_player_video.first) { - return; + return false; + } + + if (!_player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size())) { + return false; } - _player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size()); display_player_video (); + return true; } void diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index f769fd6b9..a41cb310e 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -60,7 +60,7 @@ public: boost::optional<int> dcp_decode_reduction () const; void slow_refresh (); - void quick_refresh (); + bool quick_refresh (); int dropped () const { return _dropped; |
