diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-04-11 13:29:12 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-05-07 13:30:52 +0000 |
commit | a246a5f55fbce3554201ce1f37bedaac1a959c78 (patch) | |
tree | b3e479b70a75928a534cc13bbb2e8f2a88bbece4 /src/qml/qml/qqmlcomponent.cpp | |
parent | 5b371ed6db8acbf420118c51e0004d9139379544 (diff) |
Handle property assignment failure for group property gracefully
With grouped properties, we might end up with a completePending state
afer construction failed. If the engine then is deleted before
~QQmlComponent runs, we then have a null creator pointer in the state
(see the connect to QObject::destroyed in the ctor).
Use an if check to guard against this.
Fixes: QTBUG-102425
Change-Id: Iec27cb003a81b1f72317b87297832025c74cbfe9
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ed7dd5ad011436cafda58e7fd434bda575cff1b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml/qml/qqmlcomponent.cpp')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 63305620b9..f936225066 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -345,6 +345,7 @@ void QQmlComponentPrivate::fromTypeData(const QQmlRefPointer<QQmlTypeData> &data RequiredProperties &QQmlComponentPrivate::requiredProperties() { + Q_ASSERT(state.creator); return state.creator->requiredProperties(); } @@ -447,7 +448,9 @@ QQmlComponent::~QQmlComponent() qWarning().nospace().noquote() << QLatin1String(" ") << error; } - d->completeCreate(); + // we might not have the creator anymore if the engine is gone + if (d->state.creator) + d->completeCreate(); } if (d->typeData) { |