0134d56
From 6d290336ef7c65041c7f6eb9b5094f6c4de5f845 Mon Sep 17 00:00:00 2001
0134d56
From: Ulf Hermann <ulf.hermann@qt.io>
0134d56
Date: Mon, 10 Jul 2023 07:43:28 +0200
0134d56
Subject: [PATCH 28/30] QtQml: Clean up QQmlData ctor
0134d56
MIME-Version: 1.0
0134d56
Content-Type: text/plain; charset=UTF-8
0134d56
Content-Transfer-Encoding: 8bit
0134d56
0134d56
Initialize the "dummy" member even though we never use it. Static
0134d56
analyzers complain about it and we may appreciate it having a defined
0134d56
value in the future. Also, initialize other members inline where
0134d56
possible.
0134d56
0134d56
Coverity-Id: 415867
0134d56
Change-Id: Ie428eb3294d6363afe9d7ab2d2bed6e52df0b304
0134d56
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
0134d56
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
0134d56
(cherry picked from commit 10985a568db8cfb4140140967f7d247627ec4350)
0134d56
0134d56
* asturmlechner 2023-08-12: Resolve conflicts with dev branch commits
0134d56
  10985a568db8cfb4140140967f7d247627ec4350 and
0134d56
  e5246cafffb93f69a49c133210390c253fcb71f2 and
0134d56
  d3b3fef5a878d7fd53de6a9f9fff196a273930e3
0134d56
---
0134d56
 src/qml/qml/qqmldata_p.h   | 20 ++++++++++----------
0134d56
 src/qml/qml/qqmlengine.cpp |  7 ++-----
0134d56
 2 files changed, 12 insertions(+), 15 deletions(-)
0134d56
0134d56
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
0134d56
index ee31cb38d9..bb0adf9dfa 100644
0134d56
--- a/src/qml/qml/qqmldata_p.h
0134d56
+++ b/src/qml/qml/qqmldata_p.h
0134d56
@@ -187,7 +187,7 @@ public:
0134d56
     private:
0134d56
         void layout(QQmlNotifierEndpoint*);
0134d56
     };
0134d56
-    NotifyList *notifyList;
0134d56
+    NotifyList *notifyList = nullptr;
0134d56
 
0134d56
     inline QQmlNotifierEndpoint *notify(int index);
0134d56
     void addNotify(int index, QQmlNotifierEndpoint *);
0134d56
@@ -201,12 +201,12 @@ public:
0134d56
     QQmlContextData *outerContext = nullptr;
0134d56
     QQmlContextDataRef ownContext;
0134d56
 
0134d56
-    QQmlAbstractBinding *bindings;
0134d56
-    QQmlBoundSignal *signalHandlers;
0134d56
+    QQmlAbstractBinding *bindings = nullptr;
0134d56
+    QQmlBoundSignal *signalHandlers = nullptr;
0134d56
 
0134d56
     // Linked list for QQmlContext::contextObjects
0134d56
-    QQmlData *nextContextObject;
0134d56
-    QQmlData**prevContextObject;
0134d56
+    QQmlData *nextContextObject = nullptr;
0134d56
+    QQmlData**prevContextObject = nullptr;
0134d56
 
0134d56
     inline bool hasBindingBit(int) const;
0134d56
     inline void setBindingBit(QObject *obj, int);
0134d56
@@ -216,10 +216,10 @@ public:
0134d56
     inline void setPendingBindingBit(QObject *obj, int);
0134d56
     inline void clearPendingBindingBit(int);
0134d56
 
0134d56
-    quint16 lineNumber;
0134d56
-    quint16 columnNumber;
0134d56
+    quint16 lineNumber = 0;
0134d56
+    quint16 columnNumber = 0;
0134d56
 
0134d56
-    quint32 jsEngineId; // id of the engine that created the jsWrapper
0134d56
+    quint32 jsEngineId = 0; // id of the engine that created the jsWrapper
0134d56
 
0134d56
     struct DeferredData {
0134d56
         DeferredData();
0134d56
@@ -240,7 +240,7 @@ public:
0134d56
 
0134d56
     QQmlPropertyCache *propertyCache;
0134d56
 
0134d56
-    QQmlGuardImpl *guards;
0134d56
+    QQmlGuardImpl *guards = 0;
0134d56
 
0134d56
     static QQmlData *get(const QObject *object, bool create = false) {
0134d56
         QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
0134d56
@@ -289,7 +289,7 @@ public:
0134d56
 
0134d56
 private:
0134d56
     // For attachedProperties
0134d56
-    mutable QQmlDataExtended *extendedData;
0134d56
+    mutable QQmlDataExtended *extendedData = nullptr;
0134d56
 
0134d56
     Q_NEVER_INLINE static QQmlData *createQQmlData(QObjectPrivate *priv);
0134d56
     Q_NEVER_INLINE static QQmlPropertyCache *createPropertyCache(QJSEngine *engine, QObject *object);
0134d56
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
0134d56
index 852a673ebd..86a2d2b45a 100644
0134d56
--- a/src/qml/qml/qqmlengine.cpp
0134d56
+++ b/src/qml/qml/qqmlengine.cpp
0134d56
@@ -725,11 +725,8 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o)
0134d56
 QQmlData::QQmlData()
0134d56
     : ownedByQml1(false), ownMemory(true), indestructible(true), explicitIndestructibleSet(false),
0134d56
       hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
0134d56
-      hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false),
0134d56
-      bindingBitsArraySize(InlineBindingArraySize), notifyList(nullptr),
0134d56
-      bindings(nullptr), signalHandlers(nullptr), nextContextObject(nullptr), prevContextObject(nullptr),
0134d56
-      lineNumber(0), columnNumber(0), jsEngineId(0),
0134d56
-      propertyCache(nullptr), guards(nullptr), extendedData(nullptr)
0134d56
+      hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false), dummy(0),
0134d56
+      bindingBitsArraySize(InlineBindingArraySize), propertyCache(nullptr)
0134d56
 {
0134d56
     memset(bindingBitsValue, 0, sizeof(bindingBitsValue));
0134d56
     init();
0134d56
-- 
0134d56
2.41.0
0134d56