aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-14 07:02:47 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-14 07:02:47 +0100
commitf9608af936c39c57633129a62472d315aef62d9c (patch)
tree306585c00202c47ea61eea3c353b07840e8c33b4 /src
parentb9a5d95635a2f0094cd919f0b11f37336012dc24 (diff)
Fix crash on video navigating to related video and then back and forth
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 6e9fcf3..c01ce59 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1817,8 +1817,6 @@ namespace QuickMedia {
}
};
- bool fullscreen = false;
-
while (current_page == PageType::VIDEO_CONTENT && window.isOpen()) {
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
@@ -1844,7 +1842,6 @@ namespace QuickMedia {
current_page = previous_page;
} else if(pressed_keysym == XK_f && pressing_ctrl) {
window_set_fullscreen(disp, window.getSystemHandle(), WindowFullscreenState::TOGGLE);
- fullscreen = !fullscreen;
} else if(pressed_keysym == XK_r && pressing_ctrl) {
if(!cursor_visible)
window.setMouseCursorVisible(true);
@@ -1874,14 +1871,16 @@ namespace QuickMedia {
bool page_changed = false;
page_loop(tabs, 1, [this, &video_player, &page_changed]() {
window.setMouseCursorVisible(true);
- video_player->quit_and_save_watch_later();
- while(true) {
- VideoPlayer::Error update_err = video_player->update();
- if(update_err != VideoPlayer::Error::OK)
- break;
- std::this_thread::sleep_for(std::chrono::milliseconds(20));
+ if(video_player) {
+ video_player->quit_and_save_watch_later();
+ while(true) {
+ VideoPlayer::Error update_err = video_player->update();
+ if(update_err != VideoPlayer::Error::OK)
+ break;
+ std::this_thread::sleep_for(std::chrono::milliseconds(20));
+ }
+ video_player.reset();
}
- video_player.reset();
page_changed = true;
});
@@ -1955,8 +1954,7 @@ namespace QuickMedia {
}
window.setMouseCursorVisible(true);
- if(fullscreen)
- window_set_fullscreen(disp, window.getSystemHandle(), WindowFullscreenState::UNSET);
+ window_set_fullscreen(disp, window.getSystemHandle(), WindowFullscreenState::UNSET);
auto window_size_u = window.getSize();
window_size.x = window_size_u.x;