diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2017-09-18 18:12:40 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-09-21 09:02:33 +0000 |
commit | d8593011d2d01a04a01e7bf369caa166d91b3d6a (patch) | |
tree | a667b373166bfc9c4d3c91b2b982e9f4d5e055a0 | |
parent | 61716e2bbcc62d7447b4d9e8531ad98737407d12 (diff) |
Fix crash when using signal handlers on group properties
This is a regression introduced with commmit
49a11e882059ee1729f776722e085dd21d378c36: The typeRef can be null.
I found this when testing grouped properties and property revisions.
<TestComponent.qml>
import QtQuick 2.0
Item {
property alias textEdit: textEdit
TextEdit {
id: textEdit
}
}
import QtQuick 2.8
Item {
TestComponent {
textEdit.onEditingFinished: console.log("test")
}
}
Instead of an error message, this crashes without this patch.
This is a regression introduced by using QQmlType by value.
Change-Id: Ib18a0ad878f7c4696c22bc65fee636b84b966f03
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index eeb5595a9a..fab865081a 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -412,7 +412,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio const QString &originalPropertyName = stringAt(binding->propertyNameIndex); auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); - const QQmlType type = typeRef->type; + const QQmlType type = typeRef ? typeRef->type : QQmlType(); if (type.isValid()) { COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(originalPropertyName).arg(type.module()).arg(type.majorVersion()).arg(type.minorVersion())); } else { |