diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-06 08:12:01 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-10 11:46:20 +0200 |
| commit | 3c703beea87b353d0b99187830f7a1a3f3d65b2b (patch) | |
| tree | 93ad6c20a7907542e7d4a2660df876efe5e1acfb | |
| parent | 58197c0cc5a5b66952abb58fb762a272dcd32cfa (diff) | |
shiboken tests: Fix special functions for class ObjectTypeHolder
Remove the unused CT default parameter value
ObjectType::defaultInstance() which would have led to deletion of a
stack object. Turn it into a <object-type> and disable copy/move.
Pick-to: 6.6
Task-number: PYSIDE-2479
Change-Id: I010f8d27664a37999742c47e6e446e702853344c
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
5 files changed, 5 insertions, 11 deletions
diff --git a/sources/shiboken6/tests/libsample/objecttype.cpp b/sources/shiboken6/tests/libsample/objecttype.cpp index 7df7b46f2..fa3e7357c 100644 --- a/sources/shiboken6/tests/libsample/objecttype.cpp +++ b/sources/shiboken6/tests/libsample/objecttype.cpp @@ -32,12 +32,6 @@ ObjectType *ObjectType::createWithChild() return parent; } -const ObjectType *ObjectType::defaultInstance() -{ - static ObjectType result; - return &result; -} - void ObjectType::removeChild(ObjectType *child) { if (!child) diff --git a/sources/shiboken6/tests/libsample/objecttype.h b/sources/shiboken6/tests/libsample/objecttype.h index 737f22a0a..498556459 100644 --- a/sources/shiboken6/tests/libsample/objecttype.h +++ b/sources/shiboken6/tests/libsample/objecttype.h @@ -57,8 +57,6 @@ public: inline static ObjectType *create() { return new ObjectType(); } static ObjectType *createWithChild(); - static const ObjectType *defaultInstance(); - void setParent(ObjectType *parent); inline ObjectType *parent() const { return m_parent; } inline const ObjectTypeList &children() const { return m_children; } diff --git a/sources/shiboken6/tests/libsample/objecttypeholder.cpp b/sources/shiboken6/tests/libsample/objecttypeholder.cpp index 344f54dbd..c0950d09c 100644 --- a/sources/shiboken6/tests/libsample/objecttypeholder.cpp +++ b/sources/shiboken6/tests/libsample/objecttypeholder.cpp @@ -10,7 +10,7 @@ ObjectTypeHolder::ObjectTypeHolder(const char *objectName) m_objectType = object; } -ObjectTypeHolder::ObjectTypeHolder(const ObjectType *object) : +ObjectTypeHolder::ObjectTypeHolder(const ObjectType *object) noexcept : m_objectType(object) { } diff --git a/sources/shiboken6/tests/libsample/objecttypeholder.h b/sources/shiboken6/tests/libsample/objecttypeholder.h index e457baa26..190664608 100644 --- a/sources/shiboken6/tests/libsample/objecttypeholder.h +++ b/sources/shiboken6/tests/libsample/objecttypeholder.h @@ -11,8 +11,10 @@ class LIBSAMPLE_API ObjectTypeHolder { public: + LIBMINIMAL_DISABLE_COPY_MOVE(ObjectTypeHolder) + explicit ObjectTypeHolder(const char *objectName); - explicit ObjectTypeHolder(const ObjectType *object = ObjectType::defaultInstance()); + explicit ObjectTypeHolder(const ObjectType *object) noexcept; virtual ~ObjectTypeHolder(); const ObjectType *getObjectType() const { return m_objectType; } diff --git a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml index 6fd096519..8ae6a3881 100644 --- a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml +++ b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml @@ -721,7 +721,7 @@ </modify-function> </object-type> - <value-type name="ObjectTypeHolder"/> + <object-type name="ObjectTypeHolder"/> <value-type name="OnlyCopy"/> <value-type name="FriendOfOnlyCopy"/> |
