Commit d63457c5 authored by Don Gagne's avatar Don Gagne

Merge pull request #1789 from DonLakeFlyer/WindowsClose

Queue delayed window close if open connections
parents 2974c58c 8a3218b4
...@@ -634,12 +634,16 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -634,12 +634,16 @@ void MainWindow::closeEvent(QCloseEvent *event)
tr("There are still active connections to vehicles. Do you want to disconnect these before closing?"), tr("There are still active connections to vehicles. Do you want to disconnect these before closing?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel); QMessageBox::Cancel);
if (button == QMessageBox::Yes) { if (button == QMessageBox::Yes) {
LinkManager::instance()->disconnectAll(); LinkManager::instance()->disconnectAll();
} else { // The above disconnect causes a flurry of activity as the vehicle components are removed. This in turn
event->ignore(); // causes the Windows Version of Qt to crash if you allow the close event to be accepted. In order to prevent
return; // the crash, we ignore the close event and setup a delayed timer to close the window after things settle down.
} QTimer::singleShot(1500, this, &MainWindow::_closeWindow);
}
event->ignore();
return;
} }
// This will process any remaining flight log save dialogs // This will process any remaining flight log save dialogs
......
...@@ -287,7 +287,8 @@ private slots: ...@@ -287,7 +287,8 @@ private slots:
#ifdef UNITTEST_BUILD #ifdef UNITTEST_BUILD
void _showQmlTestWidget(void); void _showQmlTestWidget(void);
#endif #endif
void _closeWindow(void) { close(); }
private: private:
/// Constructor is private since all creation should be through MainWindow::_create /// Constructor is private since all creation should be through MainWindow::_create
MainWindow(QSplashScreen* splashScreen); MainWindow(QSplashScreen* splashScreen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment