aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2026-03-20 09:45:34 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2026-03-24 13:17:59 +0000
commitc1adc16e18f15fc7ed5d1923313f94a154699804 (patch)
treeee457b4d1524a3d42dd0c0bd1795214136bc9dfa
parent1ee646729c9d22227f23caa06fff444833ff3c0c (diff)
fix double lookup in QQmlMetaType::qmlRemoveModuleRegistration()
We shouldn't do two lookups for the rare (as in: error) case that an uri is registered twice, while the non-error case always needs two. Thanksfully, the fix is very easy, as remove() already returns whether something was removed, so just use that info instead of calling contains() first. Amends dfb4778f6ae2c21c4de2d34b58a6dad465af14b0 (5.15). Pick-to: 6.8 Change-Id: I0ea166cd2c74e00fbfb49d1ef4bb241b5289d7a0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 43e299985dd0d478b6e08526c723cc2044ddf364) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 49d293a395ea9dc121ed3938ea982cfc52e0fda8)
-rw-r--r--src/qml/qml/qqmlmetatype.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index f828834314..25713e0477 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -303,10 +303,8 @@ void QQmlMetaType::qmlRemoveModuleRegistration(const QString &uri)
if (!data.isValid())
return; // shutdown/deletion race. Not a problem.
- if (!data->moduleTypeRegistrationFunctions.contains(uri))
+ if (!data->moduleTypeRegistrationFunctions.remove(uri))
qFatal("Cannot remove multiple registrations for %s", qPrintable(uri));
- else
- data->moduleTypeRegistrationFunctions.remove(uri);
}
bool QQmlMetaType::qmlRegisterModuleTypes(const QString &uri)