Browse Source

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.
cg2121 1 year ago
parent
commit
140abfeb66
2 changed files with 3 additions and 1 deletions
  1. 1 0
      UI/window-basic-main.hpp
  2. 2 1
      UI/window-dock.cpp

+ 1 - 0
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;

+ 2 - 1
UI/window-dock.cpp

@@ -1,5 +1,6 @@
 #include "window-dock.hpp"
 #include "obs-app.hpp"
+#include "window-basic-main.hpp"
 
 #include <QMessageBox>
 #include <QCheckBox>
@@ -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));
 	}