Bladeren bron

frontend: Remove crash handler earlier in shutdown

Warchamp7 2 maanden geleden
bovenliggende
commit
34a0a6a530

+ 3 - 2
frontend/OBSApp.cpp

@@ -1238,8 +1238,6 @@ bool OBSApp::OBSInit()
 	mainWindow->setAttribute(Qt::WA_DeleteOnClose, true);
 
 	connect(QApplication::instance(), &QApplication::aboutToQuit, this, [this]() {
-		crashHandler_->applicationShutdownHandler();
-
 		/* Ensure OBSMainWindow gets closed */
 		if (mainWindow) {
 			mainWindow->close();
@@ -1253,6 +1251,9 @@ bool OBSApp::OBSInit()
 
 	mainWindow->OBSInit();
 
+	connect(OBSBasic::Get(), &OBSBasic::mainWindowClosed, crashHandler_.get(),
+		&OBS::CrashHandler::applicationShutdownHandler);
+
 	connect(this, &QGuiApplication::applicationStateChanged,
 		[this](Qt::ApplicationState state) { ResetHotkeyState(state == Qt::ApplicationActive); });
 	ResetHotkeyState(applicationState() == Qt::ApplicationActive);

+ 2 - 2
frontend/data/locale/en-US.ini

@@ -397,8 +397,8 @@ ConfirmBWTest.Title="Start Bandwidth Test?"
 ConfirmBWTest.Text="You have OBS configured in bandwidth test mode. This mode allows for network testing without your channel going live. Once you are done testing, you will need to disable it in order for viewers to be able to see your stream.\n\nDo you want to continue?"
 
 # confirm exit dialog box
-ConfirmExit.Title="Exit OBS?"
-ConfirmExit.Text="OBS is currently active. All streams/recordings will be shut down. Are you sure you wish to exit?"
+ConfirmExit.Title="Active Outputs"
+ConfirmExit.Text="OBS is still currently active. All streams/recordings will be shut down."
 
 # confirm delete dialog box
 ConfirmRemove.Title="Confirm Remove"

+ 4 - 8
frontend/utility/NativeEventFilter_Windows.cpp

@@ -43,7 +43,10 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
 			}
 
 			if (main->shouldPromptForClose()) {
-				*result = FALSE;
+				if (result) {
+					*result = FALSE;
+				}
+				QTimer::singleShot(1, main, &OBSBasic::close);
 				return true;
 			}
 
@@ -52,13 +55,6 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
 			if (msg->wParam == TRUE) {
 				// Session is ending, start closing the main window now with no checks or prompts.
 				main->closeWindow();
-			} else {
-				/* Session is no longer ending. If OBS is still open, odds are it is what held
-				 * up the session end due to its higher than default priority. We call the
-				 * close method to trigger the confirmation window flow. We do this after the fact
-				 * to avoid blocking the main window event loop prior to this message.
-				 * Otherwise, OBS is already gone and invoking this does nothing. */
-				main->close();
 			}
 
 			return true;

+ 5 - 2
frontend/widgets/OBSBasic.cpp

@@ -1894,9 +1894,10 @@ bool OBSBasic::promptToClose()
 
 	SetShowing(true);
 	QMessageBox::StandardButton button =
-		OBSMessageBox::question(this, QTStr("ConfirmExit.Title"), QTStr("ConfirmExit.Text"));
+		OBSMessageBox::question(this, QTStr("ConfirmExit.Title"), QTStr("ConfirmExit.Text"),
+					QMessageBox::StandardButtons(QMessageBox::Ok | QMessageBox::Cancel));
 
-	if (button == QMessageBox::No) {
+	if (button == QMessageBox::Cancel) {
 		isClosePromptOpen_ = false;
 		return false;
 	}
@@ -1971,6 +1972,8 @@ void OBSBasic::closeWindow()
 	applicationShutdown();
 	deleteLater();
 
+	emit mainWindowClosed();
+
 	QMetaObject::invokeMethod(App(), "quit", Qt::QueuedConnection);
 }
 

+ 3 - 0
frontend/widgets/OBSBasic.hpp

@@ -341,6 +341,9 @@ protected:
 	virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
 	virtual void changeEvent(QEvent *event) override;
 
+signals:
+	void mainWindowClosed();
+
 	/* -------------------------------------
 	 * MARK: - OAuth
 	 * -------------------------------------