diff --git a/src/ui/MainWindowHybrid.qml b/src/ui/MainWindowHybrid.qml
index aa8b206..cda7b95 100644
--- a/src/ui/MainWindowHybrid.qml
+++ b/src/ui/MainWindowHybrid.qml
@@ -23,6 +23,7 @@ along with QGROUNDCONTROL. If not, see .
import QtQuick 2.5
import QtQuick.Controls 1.2
+import QtQuick.Dialogs 1.2
import QGroundControl.Controls 1.0
@@ -41,7 +42,7 @@ Item {
}
function showWindowCloseMessage() {
- mainWindowInner.item.showWindowCloseMessage()
+ windowCloseDialog.open()
}
// The following are use for unit testing only
@@ -71,5 +72,16 @@ Item {
anchors.fill: parent
source: "MainWindowInner.qml"
}
+
+ MessageDialog {
+ id: windowCloseDialog
+ title: "QGroundControl close"
+ text: "There are still active connections to vehicles. Do you want to disconnect these before closing?"
+ standardButtons: StandardButton.Yes | StandardButton.Cancel
+ modality: Qt.ApplicationModal
+ visible: false
+
+ onYes: controller.acceptWindowClose()
+ }
}
diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml
index 40ed423..d6cfdf9 100644
--- a/src/ui/MainWindowInner.qml
+++ b/src/ui/MainWindowInner.qml
@@ -64,7 +64,7 @@ Item {
flightView.visible = true
setupViewLoader.visible = false
planViewLoader.visible = false
- toolbar.checkFlyButton()
+ toolBar.checkFlyButton()
}
function showPlanView() {
@@ -93,10 +93,6 @@ Item {
toolBar.checkSetupButton()
}
- function showWindowCloseMessage() {
- windowCloseDialog.open()
- }
-
// The following are use for unit testing only
function showSetupFirmware() {
@@ -204,17 +200,6 @@ Item {
currentPopUp = indicatorDropdown
}
- MessageDialog {
- id: windowCloseDialog
- title: "QGroundControl close"
- text: "There are still active connections to vehicles. Do you want to disconnect these before closing?"
- standardButtons: StandardButton.Yes | StandardButton.Cancel
- modality: Qt.ApplicationModal
- visible: false
-
- onYes: controller.acceptWindowClose()
- }
-
//-- Left Settings Menu
Loader {
id: leftPanel
diff --git a/src/ui/MainWindowNative.qml b/src/ui/MainWindowNative.qml
index 26399ab..0ae59e2 100644
--- a/src/ui/MainWindowNative.qml
+++ b/src/ui/MainWindowNative.qml
@@ -23,12 +23,14 @@ along with QGROUNDCONTROL. If not, see .
import QtQuick 2.5
import QtQuick.Window 2.2
+import QtQuick.Dialogs 1.2
import QGroundControl 1.0
/// Native QML top level window
Window {
- visible: true
+ id: _rootWindow
+ visible: true
onClosing: {
// Disallow window close if there are active connections
@@ -56,7 +58,7 @@ Window {
}
function showWindowCloseMessage() {
- mainWindowInner.item.showWindowCloseMessage()
+ windowCloseDialog.open()
}
// The following are use for unit testing only
@@ -86,5 +88,32 @@ Window {
anchors.fill: parent
source: "MainWindowInner.qml"
}
+
+ MessageDialog {
+ id: windowCloseDialog
+ title: "QGroundControl close"
+ text: "There are still active connections to vehicles. Do you want to disconnect these before closing?"
+ standardButtons: StandardButton.Yes | StandardButton.Cancel
+ modality: Qt.ApplicationModal
+ visible: false
+
+ onYes: {
+ QGroundControl.linkManager.shutdown()
+ // The above shutdown causes a flurry of activity as the vehicle components are removed. This in turn
+ // causes the Windows Version of Qt to crash if you allow the close event to be accepted. In order to prevent
+ // the crash, we ignore the close event and setup a delayed timer to close the window after things settle down.
+ delayedWindowCloseTimer.start()
+ }
+ }
+
+ Timer {
+ id: delayedWindowCloseTimer
+ interval: 1500
+ running: false
+ repeat: false
+
+ onTriggered: _rootWindow.close()
+ }
+
}