Commit 27a4837c authored by dogmaphobic's avatar dogmaphobic

Testing for _mainQmlWidgetHolder before blindly assuming it is valid.

parent 90ecc18d
...@@ -471,11 +471,17 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -471,11 +471,17 @@ void MainWindow::closeEvent(QCloseEvent *event)
// We have to pull out the QmlWidget from the main window and delete it here, before // We have to pull out the QmlWidget from the main window and delete it here, before
// the MainWindow ends up getting deleted. Otherwise the Qml has a reference to MainWindow // the MainWindow ends up getting deleted. Otherwise the Qml has a reference to MainWindow
// inside it which in turn causes a shutdown crash. // inside it which in turn causes a shutdown crash.
// Remove image provider
_mainQmlWidgetHolder->getEngine()->removeImageProvider(QLatin1String("QGCImages")); //-- Unit test gets here with _mainQmlWidgetHolder being NULL
_centralLayout->removeWidget(_mainQmlWidgetHolder);
delete _mainQmlWidgetHolder; if(_mainQmlWidgetHolder)
_mainQmlWidgetHolder = NULL; {
// Remove image provider
_mainQmlWidgetHolder->getEngine()->removeImageProvider(QLatin1String("QGCImages"));
_centralLayout->removeWidget(_mainQmlWidgetHolder);
delete _mainQmlWidgetHolder;
_mainQmlWidgetHolder = NULL;
}
_storeCurrentViewState(); _storeCurrentViewState();
storeSettings(); storeSettings();
......
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