Fix race condition that could cause quit segue to never dismiss

Fixes #1060
This commit is contained in:
Cameron Gutman 2023-08-29 18:10:16 -05:00
parent bb444f306a
commit 7073dd26de
3 changed files with 6 additions and 7 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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: {