Fix bad application quitting with multiple windows

This commit is contained in:
Lorenzooone 2024-04-26 00:15:50 +02:00
parent 1938d01e91
commit cea5a4e40b
3 changed files with 17 additions and 3 deletions

View File

@ -127,6 +127,7 @@ public:
void display_call(bool is_main_thread);
void display_thread(CaptureData* capture_data);
void end();
void after_thread_join();
void draw(double frame_time, VideoOutputData* out_buf);
void print_notification(std::string text, TextKind kind = TEXT_KIND_NORMAL);

View File

@ -290,6 +290,8 @@ void WindowScreen::poll() {
break;
}
break;
default:
break;
}
}
@ -324,8 +326,8 @@ void WindowScreen::display_thread(CaptureData* capture_data) {
this->display_call(false);
}
}
if(this->m_win.isOpen())
this->m_win.close();
if(!this->main_thread_owns_window)
this->m_win.setActive(false);
this->done_display = true;
}
@ -335,6 +337,13 @@ void WindowScreen::end() {
this->display_lock.unlock();
}
void WindowScreen::after_thread_join() {
if(this->m_win.isOpen()) {
this->m_win.setActive(true);
this->m_win.close();
}
}
void WindowScreen::draw(double frame_time, VideoOutputData* out_buf) {
if(!this->done_display)
return;
@ -537,7 +546,7 @@ void WindowScreen::window_factory(bool is_main_thread) {
}
void WindowScreen::pre_texture_conversion_processing() {
//Place preprocessing effects here
//Place preprocessing window-specific effects here
this->in_tex.update((uint8_t*)this->saved_buf, IN_VIDEO_WIDTH, IN_VIDEO_HEIGHT, 0, 0);
}

View File

@ -356,6 +356,10 @@ void mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data) {
bot_thread.join();
joint_thread.join();
top_screen.after_thread_join();
bot_screen.after_thread_join();
joint_screen.after_thread_join();
if (!skip_io) {
save(base_path, base_name, top_screen.m_info, bot_screen.m_info, joint_screen.m_info, display_data, audio_data, out_text_data);
}