aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-19 11:42:28 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-27 22:40:47 +0000
commiteaca39813d0777f0c0c052732275e562a73c0f71 (patch)
tree83da92603a9399a2df1f8122b7b33c191b42a578
parent0e351cd2cd7ff75c9425b5c33b5d8bff7e274b48 (diff)
shiboken6: Do not construct AbstractMetaType with a null type entry
This can lead to crashes later on. Change-Id: I37dfa82885dfbf81de101e58bea774258ccfa86f Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 5929e397bbe41c45ba416ce87dfa5b431ea224c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetatype.cpp4
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
index 075315d58..dd61421e2 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
@@ -88,10 +88,12 @@ AbstractMetaTypeData::AbstractMetaTypeData(const TypeEntry *t) :
AbstractMetaType::AbstractMetaType(const TypeEntry *t) : d(new AbstractMetaTypeData(t))
{
+ Q_ASSERT(t);
}
-AbstractMetaType::AbstractMetaType() : d(new AbstractMetaTypeData(nullptr))
+AbstractMetaType::AbstractMetaType()
{
+ *this = AbstractMetaType::createVoid();
}
AbstractMetaType &AbstractMetaType::operator=(const AbstractMetaType &) = default;
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.cpp b/sources/shiboken6/generator/shiboken/overloaddata.cpp
index 9cc492792..515dfd31d 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.cpp
+++ b/sources/shiboken6/generator/shiboken/overloaddata.cpp
@@ -442,7 +442,7 @@ void OverloadData::sortNextOverloads()
*/
OverloadData::OverloadData(const AbstractMetaFunctionCList &overloads,
const ApiExtractorResult &api)
- : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(nullptr),
+ : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(),
m_headOverloadData(this), m_previousOverloadData(nullptr),
m_api(api)
{