diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-18 09:56:00 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-18 12:22:25 (GMT) |
commit | a3ef1b5e0d8e7181793db07ba3a2fe1546c952ac (patch) | |
tree | 54a230964f34bf8648d71d582227bcd83ef23b13 | |
parent | 4c5dada4b12f5600c31da84b5823ec4cbf0c91e7 (diff) | |
download | Qt-a3ef1b5e0d8e7181793db07ba3a2fe1546c952ac.zip Qt-a3ef1b5e0d8e7181793db07ba3a2fe1546c952ac.tar.gz Qt-a3ef1b5e0d8e7181793db07ba3a2fe1546c952ac.tar.bz2 |
fix a crash when registering 2 metatype name for the same actual type
Reviewed-by: ogoffart
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 30af6fa..ce9ed58 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -518,19 +518,15 @@ int QMetaType::registerTypedef(const char* typeName, int aliasId) idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), normalizedTypeName.size()); - if (idx) { - Q_ASSERT(idx == aliasId); + if (idx) return idx; - } - if (!idx) { - QCustomTypeInfo inf; - inf.typeName = normalizedTypeName; - inf.alias = aliasId; - inf.constr = 0; - inf.destr = 0; - ct->append(inf); - } + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.alias = aliasId; + inf.constr = 0; + inf.destr = 0; + ct->append(inf); return aliasId; } |