From ccf36b68fc9bcacdefca09d4b4f3d7dbcb61f95c Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Wed, 20 Apr 2016 20:29:03 +0200 Subject: [PATCH] obs: Remove draw callbacks when closing various windows Fixes a race condition during shutdown where the dialogs aren't deleted before another render attempt occurs, by which time the sources are already freed, resulting in a crash. --- obs/window-basic-filters.cpp | 3 +++ obs/window-basic-interaction.cpp | 3 +++ obs/window-basic-properties.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/obs/window-basic-filters.cpp b/obs/window-basic-filters.cpp index e9eabd45e..2eeb437c2 100644 --- a/obs/window-basic-filters.cpp +++ b/obs/window-basic-filters.cpp @@ -394,6 +394,9 @@ void OBSBasicFilters::closeEvent(QCloseEvent *event) if (!event->isAccepted()) return; + obs_display_remove_draw_callback (ui->preview->GetDisplay(), + OBSBasicFilters::DrawPreview, this); + main->SaveProject(); } diff --git a/obs/window-basic-interaction.cpp b/obs/window-basic-interaction.cpp index e1585f053..a0265fc15 100644 --- a/obs/window-basic-interaction.cpp +++ b/obs/window-basic-interaction.cpp @@ -168,6 +168,9 @@ void OBSBasicInteraction::closeEvent(QCloseEvent *event) width()); config_set_int(App()->GlobalConfig(), "InteractionWindow", "cy", height()); + + obs_display_remove_draw_callback(ui->preview->GetDisplay(), + OBSBasicInteraction::DrawPreview, this); } static int TranslateQtKeyboardEventModifiers(QInputEvent *event, bool mouseEvent) { diff --git a/obs/window-basic-properties.cpp b/obs/window-basic-properties.cpp index 4594b0006..2fad427da 100644 --- a/obs/window-basic-properties.cpp +++ b/obs/window-basic-properties.cpp @@ -205,6 +205,9 @@ void OBSBasicProperties::Cleanup() width()); config_set_int(App()->GlobalConfig(), "PropertiesWindow", "cy", height()); + + obs_display_remove_draw_callback(preview->GetDisplay(), + OBSBasicProperties::DrawPreview, this); } void OBSBasicProperties::reject()