From 7073dd26de9aa9fb072e2c990bc3fef6f1c44d1c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 29 Aug 2023 18:10:16 -0500 Subject: [PATCH] Fix race condition that could cause quit segue to never dismiss Fixes #1060 --- app/gui/AppView.qml | 5 +---- app/gui/CliStartStreamSegue.qml | 4 +--- app/gui/QuitSegue.qml | 4 ++++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/gui/AppView.qml b/app/gui/AppView.qml index 67000870..f724f768 100644 --- a/app/gui/AppView.qml +++ b/app/gui/AppView.qml @@ -345,7 +345,7 @@ CenteredGridView { function quitApp() { var component = Qt.createComponent("QuitSegue.qml") - var params = {"appName": appName} + var params = {"appName": appName, "quitRunningAppFn": appModel.quitRunningApp} if (segueToStream) { // Store the session and app name if we're going to stream after // successfully quitting the old app. @@ -358,9 +358,6 @@ CenteredGridView { } stackView.push(component.createObject(stackView, params)) - - // Trigger the quit after pushing the quit segue on screen - appModel.quitRunningApp() } onAccepted: quitApp() diff --git a/app/gui/CliStartStreamSegue.qml b/app/gui/CliStartStreamSegue.qml index 55207c7c..3ae2d19a 100644 --- a/app/gui/CliStartStreamSegue.qml +++ b/app/gui/CliStartStreamSegue.qml @@ -84,10 +84,8 @@ Item { function quitApp() { var component = Qt.createComponent("QuitSegue.qml") - var params = {"appName": appName} + var params = {"appName": appName, "quitRunningAppFn": launcher.quitRunningApp} stackView.push(component.createObject(stackView, params)) - // Trigger the quit after pushing the quit segue on screen - launcher.quitRunningApp() } onAccepted: quitApp() diff --git a/app/gui/QuitSegue.qml b/app/gui/QuitSegue.qml index 1b64efa9..48054b48 100644 --- a/app/gui/QuitSegue.qml +++ b/app/gui/QuitSegue.qml @@ -6,6 +6,7 @@ import Session 1.0 Item { property string appName + property var quitRunningAppFn property Session nextSession : null property string nextAppName : "" @@ -37,6 +38,9 @@ Item { // Connect the quit completion signal ComputerManager.quitAppCompleted.connect(quitAppCompleted) + + // Start the quit operation + quitRunningAppFn() } StackView.onDeactivating: {