diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 7c2c3648df..22b5ef8df3 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -240,26 +240,6 @@ QQmlImageProviderBase::~QQmlImageProviderBase() { } - -QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) -: propertyCapture(nullptr), rootContext(nullptr), -#if QT_CONFIG(qml_debug) - profiler(nullptr), -#endif - outputWarningsToMsgLog(true), - erroredBindings(nullptr), inProgressCreations(0), -#if QT_CONFIG(qml_worker_script) - workerScriptEngine(nullptr), -#endif - activeObjectCreator(nullptr), -#if QT_CONFIG(qml_network) - networkAccessManager(nullptr), networkAccessManagerFactory(nullptr), -#endif - scarceResourcesRefCount(0), importDatabase(e), typeLoader(e), - uniqueId(1), incubatorCount(0), incubationController(nullptr) -{ -} - QQmlEnginePrivate::~QQmlEnginePrivate() { if (inProgressCreations) @@ -1445,7 +1425,7 @@ static void dumpwarning(const QList &errors) void QQmlEnginePrivate::warning(const QQmlError &error) { Q_Q(QQmlEngine); - q->warnings(QList() << error); + emit q->warnings(QList({error})); if (outputWarningsToMsgLog) dumpwarning(error); } @@ -1453,7 +1433,7 @@ void QQmlEnginePrivate::warning(const QQmlError &error) void QQmlEnginePrivate::warning(const QList &errors) { Q_Q(QQmlEngine); - q->warnings(errors); + emit q->warnings(errors); if (outputWarningsToMsgLog) dumpwarning(errors); } diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 978b4d2d24..c0e8f53ddc 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -135,7 +135,7 @@ class Q_QML_PRIVATE_EXPORT QQmlEnginePrivate : public QJSEnginePrivate { Q_DECLARE_PUBLIC(QQmlEngine) public: - QQmlEnginePrivate(QQmlEngine *); + explicit QQmlEnginePrivate(QQmlEngine *q) : importDatabase(q), typeLoader(q) {} ~QQmlEnginePrivate() override; void init(); @@ -143,47 +143,47 @@ public: // is just qmlClearTypeRegistrations (which can't be called while an engine exists) static bool baseModulesUninitialized; - QQmlPropertyCapture *propertyCapture; + QQmlPropertyCapture *propertyCapture = nullptr; QRecyclePool jsExpressionGuardPool; QRecyclePool qPropertyTriggerPool; - QQmlContext *rootContext; + QQmlContext *rootContext = nullptr; Q_OBJECT_BINDABLE_PROPERTY(QQmlEnginePrivate, QString, translationLanguage); #if !QT_CONFIG(qml_debug) static const quintptr profiler = 0; #else - QQmlProfiler *profiler; + QQmlProfiler *profiler = nullptr; #endif - bool outputWarningsToMsgLog; + bool outputWarningsToMsgLog = true; // Bindings that have had errors during startup - QQmlDelayedError *erroredBindings; - int inProgressCreations; + QQmlDelayedError *erroredBindings = nullptr; + int inProgressCreations = 0; QV4::ExecutionEngine *v4engine() const { return q_func()->handle(); } #if QT_CONFIG(qml_worker_script) - QThread *workerScriptEngine; + QThread *workerScriptEngine = nullptr; #endif QUrl baseUrl; - QQmlObjectCreator *activeObjectCreator; + QQmlObjectCreator *activeObjectCreator = nullptr; #if QT_CONFIG(qml_network) QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const; QNetworkAccessManager *getNetworkAccessManager() const; - mutable QNetworkAccessManager *networkAccessManager; - mutable QQmlNetworkAccessManagerFactory *networkAccessManagerFactory; + mutable QNetworkAccessManager *networkAccessManager = nullptr; + mutable QQmlNetworkAccessManagerFactory *networkAccessManagerFactory = nullptr; #endif QHash > imageProviders; QSharedPointer imageProvider(const QString &providerId) const; QList urlInterceptors; - int scarceResourcesRefCount; + int scarceResourcesRefCount = 0; void referenceScarceResources(); void dereferenceScarceResources(); @@ -192,11 +192,6 @@ public: QString offlineStoragePath; - mutable quint32 uniqueId; - inline quint32 getUniqueId() const { - return uniqueId++; - } - // Unfortunate workaround to avoid a circular dependency between // qqmlengine_p.h and qqmlincubator_p.h struct Incubator : public QSharedData { @@ -205,8 +200,8 @@ public: QIntrusiveListNode nextWaitingFor; }; QIntrusiveList incubatorList; - unsigned int incubatorCount; - QQmlIncubationController *incubationController; + unsigned int incubatorCount = 0; + QQmlIncubationController *incubationController = nullptr; void incubate(QQmlIncubator &, const QQmlRefPointer &); // These methods may be called from any thread @@ -252,8 +247,6 @@ public: static QList qmlErrorFromDiagnostics(const QString &fileName, const QList &diagnosticMessages); - static void defineModule(); - static bool designerMode(); static void activateDesignerMode();