Fixing potential crash in dialog popups

This commit is contained in:
Brad Davis 2016-01-26 16:58:32 -08:00
parent cea57a111b
commit 5f38c5265c

View file

@ -150,7 +150,9 @@ protected:
}
~ModalDialogListener() {
disconnect(_dialog);
if (_dialog) {
disconnect(_dialog);
}
}
virtual QVariant waitForResult() {
@ -164,10 +166,11 @@ protected slots:
void onDestroyed() {
_finished = true;
disconnect(_dialog);
_dialog = nullptr;
}
protected:
QQuickItem* const _dialog;
QQuickItem* _dialog;
bool _finished { false };
QVariant _result;
};
@ -372,6 +375,7 @@ void OffscreenUi::createDesktop(const QUrl& url) {
qDebug() << "Desktop already created";
return;
}
#ifdef DEBUG
getRootContext()->setContextProperty("DebugQML", QVariant(true));
#else
@ -382,9 +386,6 @@ void OffscreenUi::createDesktop(const QUrl& url) {
Q_ASSERT(_desktop);
getRootContext()->setContextProperty("desktop", _desktop);
// Enable focus debugging
_desktop->setProperty("offscreenWindow", QVariant::fromValue(getWindow()));
_toolWindow = _desktop->findChild<QQuickItem*>("ToolWindow");
new VrMenu(this);