mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-04 00:36:36 +00:00
Work around Qt 5.12 dialog crash on disconnect
This commit is contained in:
parent
a05816b495
commit
fa29260e09
@ -20,7 +20,7 @@ Item {
|
|||||||
function stageFailed(stage, errorCode)
|
function stageFailed(stage, errorCode)
|
||||||
{
|
{
|
||||||
// Display the error dialog after Session::exec() returns
|
// Display the error dialog after Session::exec() returns
|
||||||
errorDialog.text = "Starting " + stage + " failed: Error " + errorCode
|
streamSegueErrorDialog.text = "Starting " + stage + " failed: Error " + errorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectionStarted()
|
function connectionStarted()
|
||||||
@ -38,7 +38,7 @@ Item {
|
|||||||
function displayLaunchError(text)
|
function displayLaunchError(text)
|
||||||
{
|
{
|
||||||
// Display the error dialog after Session::exec() returns
|
// Display the error dialog after Session::exec() returns
|
||||||
errorDialog.text = text
|
streamSegueErrorDialog.text = text
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayLaunchWarning(text)
|
function displayLaunchWarning(text)
|
||||||
@ -68,9 +68,10 @@ Item {
|
|||||||
SdlGamepadKeyNavigation.enable()
|
SdlGamepadKeyNavigation.enable()
|
||||||
|
|
||||||
if (quitAfter) {
|
if (quitAfter) {
|
||||||
if (errorDialog.text) {
|
if (streamSegueErrorDialog.text) {
|
||||||
// Quit when the error dialog is acknowledged
|
// Quit when the error dialog is acknowledged
|
||||||
errorDialog.open()
|
streamSegueErrorDialog.quitAfter = quitAfter
|
||||||
|
streamSegueErrorDialog.open()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Quit immediately
|
// Quit immediately
|
||||||
@ -87,8 +88,9 @@ Item {
|
|||||||
// the Qt UI is visible again to prevent losing
|
// the Qt UI is visible again to prevent losing
|
||||||
// focus on the dialog which would impact gamepad
|
// focus on the dialog which would impact gamepad
|
||||||
// users.
|
// users.
|
||||||
if (errorDialog.text) {
|
if (streamSegueErrorDialog.text) {
|
||||||
errorDialog.open()
|
streamSegueErrorDialog.quitAfter = quitAfter
|
||||||
|
streamSegueErrorDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,14 +173,4 @@ Item {
|
|||||||
|
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorMessageDialog {
|
|
||||||
id: errorDialog
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
if (quitAfter) {
|
|
||||||
Qt.quit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -421,6 +421,29 @@ ApplicationWindow {
|
|||||||
onAccepted: Qt.quit()
|
onAccepted: Qt.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: This belongs in StreamSegue but keeping a dialog around after the parent
|
||||||
|
// dies can trigger bugs in Qt 5.12 that cause the app to crash. For now, we will
|
||||||
|
// host this dialog in a QML component that is never destroyed.
|
||||||
|
//
|
||||||
|
// To repro: Start a stream, cut the network connection to trigger the "Connection
|
||||||
|
// terminated" dialog, wait until the app grid times out back to the PC grid, then
|
||||||
|
// try to dismiss the dialog.
|
||||||
|
ErrorMessageDialog {
|
||||||
|
id: streamSegueErrorDialog
|
||||||
|
|
||||||
|
property bool quitAfter: false
|
||||||
|
|
||||||
|
onClosed: {
|
||||||
|
if (quitAfter) {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
|
||||||
|
// StreamSegue assumes its dialog will be re-created each time we
|
||||||
|
// start streaming, so fake it by wiping out the text each time.
|
||||||
|
text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NavigableDialog {
|
NavigableDialog {
|
||||||
id: addPcDialog
|
id: addPcDialog
|
||||||
property string label: "Enter the IP address of your GameStream PC:"
|
property string label: "Enter the IP address of your GameStream PC:"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user