From 140abfeb665f3215abb390cfeb3d4833517354d5 Mon Sep 17 00:00:00 2001 From: cg2121 Date: Sat, 2 Mar 2024 19:08:10 -0600 Subject: [PATCH] UI: Fix closing OBS with floating docks When OBS is closed and there is a floating dock, a Windows system sound is emitted. This fixes that by not executing the close dock dialog when OBS is closing. --- UI/window-basic-main.hpp | 1 + UI/window-dock.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 473b5fb9e..a430f39cc 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -1042,6 +1042,7 @@ public: void SetDisplayAffinity(QWindow *window); QColor GetSelectionColor() const; + inline bool Closing() { return closing; } protected: virtual void closeEvent(QCloseEvent *event) override; diff --git a/UI/window-dock.cpp b/UI/window-dock.cpp index 3c3eed995..eadd3724a 100644 --- a/UI/window-dock.cpp +++ b/UI/window-dock.cpp @@ -1,5 +1,6 @@ #include "window-dock.hpp" #include "obs-app.hpp" +#include "window-basic-main.hpp" #include #include @@ -27,7 +28,7 @@ void OBSDock::closeEvent(QCloseEvent *event) bool warned = config_get_bool(App()->GlobalConfig(), "General", "WarnedAboutClosingDocks"); - if (!warned) { + if (!OBSBasic::Get()->Closing() && !warned) { QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection, Q_ARG(VoidFunc, msgBox)); }