static void markObjects(Managed *that);
QV8Engine *v8;
- QQmlGuard<QObject> parent;
+ QPointer<QObject> parent;
QV4::Value valuemap;
QV4::Value qmlGlobal;
QV4::Value m_statusChanged;
bool isNullWrapper;
QQmlGuardedContextData context;
- QQmlGuard<QObject> scopeObject;
+ QPointer<QObject> scopeObject;
};
}
void QQmlEnginePrivate::registerFinalizeCallback(QObject *obj, int index)
{
if (activeVME) {
- activeVME->finalizeCallbacks.append(qMakePair(QQmlGuard<QObject>(obj), index));
+ activeVME->finalizeCallbacks.append(qMakePair(QPointer<QObject>(obj), index));
} else {
void *args[] = { 0 };
QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, args);
QUrl baseUrl;
- typedef QPair<QQmlGuard<QObject>,int> FinalizeCallback;
+ typedef QPair<QPointer<QObject>,int> FinalizeCallback;
void registerFinalizeCallback(QObject *obj, int index);
QQmlVME *activeVME;
#include "qqmlexpression.h"
-#include <private/qqmlguard_p.h>
#include <private/qqmlengine_p.h>
#include <private/qfieldlist_p.h>
#include <private/qflagpointer_p.h>
enum Progress { Execute, Completing, Completed };
Progress progress;
- QQmlGuard<QObject> result;
+ QPointer<QObject> result;
QQmlGuardedContextData rootContext;
QQmlCompiledData *compiledData;
QQmlVME vme;
//
#include "qqmllist.h"
-#include "qqmlguard_p.h"
#include "qqmlpropertycache_p.h"
QT_BEGIN_NAMESPACE
static QQmlListReference init(const QQmlListProperty<QObject> &, int, QQmlEngine *);
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
QQmlMetaObject elementType;
QQmlListProperty<QObject> property;
int propertyType;
//
#include <QtCore/qglobal.h>
+#include <QtCore/qpointer.h>
+
#include <QtQml/qqmllist.h>
-#include <private/qqmlguard_p.h>
#include <private/qv4value_p.h>
#include <private/qv4object_p.h>
private:
QV8Engine *v8;
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
QQmlListProperty<QObject> property;
int propertyType;
#include <private/qqmlproxymetaobject_p.h>
#include <private/qqmlcustomparser_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qhashedstring_p.h>
#include <private/qqmlimport_p.h>
#define QQMLNOTIFIER_P_H
#include "qqmldata_p.h"
-#include "qqmlguard_p.h"
#include <QtCore/qmetaobject.h>
#include <private/qmetaobject_p.h>
#include <private/qobject_p.h>
#include <private/qtqmlglobal_p.h>
#include <private/qqmlpropertycache_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qqmlboundsignalexpressionpointer_p.h>
QT_BEGIN_NAMESPACE
Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
QQmlContextData *context;
- QQmlGuard<QQmlEngine> engine;
- QQmlGuard<QObject> object;
+ QPointer<QQmlEngine> engine;
+ QPointer<QObject> object;
QQmlPropertyData core;
//
#include <QtCore/qglobal.h>
+#include <QtCore/qpointer.h>
-#include <private/qqmlguard_p.h>
#include <private/qv4value_p.h>
#include <private/qv4object_p.h>
private:
QV8Engine *v8;
TypeNameMode mode;
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
QQmlType *type;
QQmlTypeNameCache *typeNamespace;
public:
QmlValueTypeReference(QV8Engine *engine);
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
int property;
};
clear();
m_objectCount = vme->objects.count();
- m_objects = new QQmlGuard<QObject>[m_objectCount];
+ m_objects = new QPointer<QObject>[m_objectCount];
for (int ii = 0; ii < m_objectCount; ++ii)
m_objects[ii] = vme->objects[ii];
private:
int m_objectCount;
- QQmlGuard<QObject> *m_objects;
+ QPointer<QObject> *m_objects;
int m_contextCount;
QQmlGuardedContextData *m_contexts;
};
QString m_statusText;
QNetworkRequest m_request;
QStringList m_addedHeaders;
- QQmlGuard<QNetworkReply> m_network;
+ QPointer<QNetworkReply> m_network;
void destroyNetwork();
QNetworkAccessManager *m_nam;
#include <QtCore/qurl.h>
#include <private/qqmlcontext_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qv4value_p.h>
#include <private/qv4context_p.h>
QV4::ExecutionEngine *v4;
QNetworkAccessManager *m_network;
- QQmlGuard<QNetworkReply> m_reply;
+ QPointer<QNetworkReply> m_reply;
QUrl m_url;
int m_redirectCount;
#include "qv4qobjectwrapper_p.h"
-#include <private/qqmlguard_p.h>
#include <private/qqmlpropertycache_p.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlvmemetaobject_p.h>
void QObjectWrapper::collectDeletables(Managed *m, GCDeletable **deletable)
{
QObjectWrapper *This = static_cast<QObjectWrapper*>(m);
- QQmlGuard<QObject> &object = This->m_object;
+ QPointer<QObject> &object = This->m_object;
if (!object)
return;
result += QString::fromUtf8(m_object->metaObject()->className());
result += QLatin1String("(0x");
- result += QString::number((quintptr)m_object.object(),16);
+ result += QString::number((quintptr)m_object.data(),16);
if (!objectName.isEmpty()) {
result += QLatin1String(", \"");
QQmlPropertyData *findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const;
- QQmlGuard<QObject> m_object;
+ QPointer<QObject> m_object;
String *m_destroy;
String *m_toString;
QV4::Value method_toString(QV4::ExecutionContext *ctx);
QV4::Value method_destroy(QV4::ExecutionContext *ctx, Value *args, int argc);
- QQmlGuard<QObject> m_object;
+ QPointer<QObject> m_object;
int m_index;
QV4::PersistentValue m_qmlGlobal;
QObject *object() const { return m_object.data(); }
private:
- QQmlGuard<QObject> m_object;
+ QPointer<QObject> m_object;
int m_signalIndex;
static void destroy(Managed *that)
}
mutable Container m_container;
- QQmlGuard<QObject> m_object;
+ QPointer<QObject> m_object;
int m_propertyIndex;
bool m_isReference;
#include <private/qqmlnullablevalue_p_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qqmlbinding_p.h>
-#include <private/qqmlguard_p.h>
#include <qqmlengine.h>
#include <qqmlcontext.h>
QQmlNullableValue<bool> when;
bool componentComplete;
- QQmlGuard<QObject> obj;
+ QPointer<QObject> obj;
QString propName;
QQmlNullableValue<QVariant> value;
QQmlProperty prop;
int parseGroups(const QStringList &groupNames) const;
int parseGroups(const QV4::Value &groupNames) const;
- QQmlGuard<QQmlDelegateModel> model;
+ QPointer<QQmlDelegateModel> model;
const int groupCount;
QV8Engine * const v8Engine;
QQmlDelegateModelAttachedMetaObject *metaObject;
QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const;
Compositor::Group group;
- QQmlGuard<QQmlDelegateModel> model;
+ QPointer<QQmlDelegateModel> model;
QQmlDelegateModelGroupEmitterList emitters;
QQmlChangeSet changeSet;
QString name;
const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::Role::DataType type)
{
- const int dataSizes[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QQmlGuard<QObject>), sizeof(QVariantMap), sizeof(QDateTime) };
+ const int dataSizes[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QPointer<QObject>), sizeof(QVariantMap), sizeof(QDateTime) };
const int dataAlignments[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QObject *), sizeof(QVariantMap), sizeof(QDateTime) };
Role *r = new Role;
QObject *ListElement::getQObjectProperty(const ListLayout::Role &role)
{
char *mem = getPropertyMemory(role);
- QQmlGuard<QObject> *o = reinterpret_cast<QQmlGuard<QObject> *>(mem);
+ QPointer<QObject> *o = reinterpret_cast<QPointer<QObject> *>(mem);
return o->data();
}
return dt;
}
-QQmlGuard<QObject> *ListElement::getGuardProperty(const ListLayout::Role &role)
+QPointer<QObject> *ListElement::getGuardProperty(const ListLayout::Role &role)
{
char *mem = getPropertyMemory(role);
bool existingGuard = false;
- for (size_t i=0 ; i < sizeof(QQmlGuard<QObject>) ; ++i) {
+ for (size_t i=0 ; i < sizeof(QPointer<QObject>) ; ++i) {
if (mem[i] != 0) {
existingGuard = true;
break;
}
}
- QQmlGuard<QObject> *o = 0;
+ QPointer<QObject> *o = 0;
if (existingGuard)
- o = reinterpret_cast<QQmlGuard<QObject> *>(mem);
+ o = reinterpret_cast<QPointer<QObject> *>(mem);
return o;
}
break;
case ListLayout::Role::QObject:
{
- QQmlGuard<QObject> *guard = reinterpret_cast<QQmlGuard<QObject> *>(mem);
+ QPointer<QObject> *guard = reinterpret_cast<QPointer<QObject> *>(mem);
QObject *object = guard->data();
if (object)
data = QVariant::fromValue(object);
if (role.type == ListLayout::Role::QObject) {
char *mem = getPropertyMemory(role);
- QQmlGuard<QObject> *g = reinterpret_cast<QQmlGuard<QObject> *>(mem);
+ QPointer<QObject> *g = reinterpret_cast<QPointer<QObject> *>(mem);
bool existingGuard = false;
- for (size_t i=0 ; i < sizeof(QQmlGuard<QObject>) ; ++i) {
+ for (size_t i=0 ; i < sizeof(QPointer<QObject>) ; ++i) {
if (mem[i] != 0) {
existingGuard = true;
break;
bool changed;
if (existingGuard) {
changed = g->data() != o;
- g->~QQmlGuard();
+ g->~QPointer();
} else {
changed = true;
}
- new (mem) QQmlGuard<QObject>(o);
+ new (mem) QPointer<QObject>(o);
if (changed)
roleIndex = role.index;
}
void ListElement::setQObjectPropertyFast(const ListLayout::Role &role, QObject *o)
{
char *mem = getPropertyMemory(role);
- new (mem) QQmlGuard<QObject>(o);
+ new (mem) QPointer<QObject>(o);
}
void ListElement::setListPropertyFast(const ListLayout::Role &role, ListModel *m)
break;
case ListLayout::Role::QObject:
{
- QQmlGuard<QObject> *guard = getGuardProperty(r);
+ QPointer<QObject> *guard = getGuardProperty(r);
if (guard)
- guard->~QQmlGuard();
+ guard->~QPointer();
}
break;
case ListLayout::Role::VariantMap:
ListModel *getListProperty(const ListLayout::Role &role);
QString *getStringProperty(const ListLayout::Role &role);
QObject *getQObjectProperty(const ListLayout::Role &role);
- QQmlGuard<QObject> *getGuardProperty(const ListLayout::Role &role);
+ QPointer<QObject> *getGuardProperty(const ListLayout::Role &role);
QVariantMap *getVariantMapProperty(const ListLayout::Role &role);
QDateTime *getDateTimeProperty(const ListLayout::Role &role);
QObject *modelData() const { return object; }
QObject *proxiedObject() { return object; }
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
};
class VDMObjectDelegateDataType : public QQmlRefCount, public QQmlAdaptorModel::Accessors
QQuickDragGrabber dragGrabber;
- QQmlGuard<QObject> source;
- QQmlGuard<QObject> target;
- QQmlGuard<QQuickWindow> window;
+ QPointer<QObject> source;
+ QPointer<QObject> target;
+ QPointer<QQuickWindow> window;
QQuickItem *attachedItem;
QQuickDragMimeData *mimeData;
Qt::DropAction proposedAction;
#include <QtQuick/qquickitem.h>
#include <private/qv8engine_p.h>
+#include <private/qqmlguard_p.h>
#include <QtCore/qmimedata.h>
#include <QtCore/qstringlist.h>
QRegExp keyRegExp;
QPointF dragPosition;
QQuickDropAreaDrag *drag;
- QQmlGuard<QObject> source;
- QQmlGuard<QMimeData> mimeData;
+ QPointer<QObject> source;
+ QPointer<QMimeData> mimeData;
};
QQuickDropAreaPrivate::QQuickDropAreaPrivate()
#include "qquickflipable_p.h"
#include "qquickitem_p.h"
-#include <private/qqmlguard_p.h>
#include <QtQml/qqmlinfo.h>
void setBackTransform();
QQuickFlipable::Side current;
- QQmlGuard<QQuickLocalTransform> backTransform;
- QQmlGuard<QQuickItem> front;
- QQmlGuard<QQuickItem> back;
+ QPointer<QQuickLocalTransform> backTransform;
+ QPointer<QQuickItem> front;
+ QPointer<QQuickItem> back;
bool sideDirty;
bool wantBackXFlipped;
#ifndef QQUICKGRIDVIEW_P_H
#define QQUICKGRIDVIEW_P_H
+#include <QtCore/qpointer.h>
+
#include "qquickitemview_p.h"
-#include <private/qqmlguard_p.h>
QT_BEGIN_NAMESPACE
void viewChanged();
public:
- QQmlGuard<QQuickGridView> m_view;
+ QPointer<QQuickGridView> m_view;
};
q->polish();
}
- QQmlGuard<QQmlInstanceModel> model;
+ QPointer<QQmlInstanceModel> model;
QVariant modelVariant;
int itemCount;
int buffer;
#define QQUICKLISTVIEW_P_H
#include "qquickitemview_p.h"
-
-#include <private/qqmlguard_p.h>
+#include <qpointer.h>
QT_BEGIN_NAMESPACE
void viewChanged();
public:
- QQmlGuard<QQuickListView> m_view;
+ QPointer<QQuickListView> m_view;
QQuickItem *m_sectionItem;
};
#include <QtCore/qcoreapplication.h>
#include <private/qquickanimation_p_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qqmldelegatemodel_p.h>
#include <private/qquicktimeline_p_p.h>
QQuickPath *path;
int currentIndex;
- QQmlGuard<QQuickItem> currentItem;
+ QPointer<QQuickItem> currentItem;
qreal currentItemOffset;
qreal startPc;
QPointF startPoint;
qreal requestedZ;
QList<QQuickItem *> items;
QList<QQuickItem *> itemCache;
- QQmlGuard<QQmlInstanceModel> model;
+ QPointer<QQmlInstanceModel> model;
QVariant modelVariant;
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
QPointer<QQmlInstanceModel> model;
QVariant dataSource;
- QQmlGuard<QObject> dataSourceAsObject;
+ QPointer<QObject> dataSourceAsObject;
bool ownModel : 1;
bool inRequest : 1;
bool dataSourceIsObject : 1;
rewindParent(0), rewindStackBefore(0) {}
QQuickItem *target;
- QQmlGuard<QQuickItem> parent;
- QQmlGuard<QQuickItem> origParent;
- QQmlGuard<QQuickItem> origStackBefore;
+ QPointer<QQuickItem> parent;
+ QPointer<QQuickItem> origParent;
+ QPointer<QQuickItem> origStackBefore;
QQuickItem *rewindParent;
QQuickItem *rewindStackBefore;
QPointF pressPos;
QPointF tripleClickStartPoint;
- QQmlGuard<QQmlComponent> cursorComponent;
+ QPointer<QQmlComponent> cursorComponent;
#ifndef QT_NO_VALIDATOR
- QQmlGuard<QValidator> m_validator;
+ QPointer<QValidator> m_validator;
#endif
qreal hscroll;
void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining)
{
- QQmlGuard<QQuickItem> item(*items);
+ QPointer<QQuickItem> item(*items);
if (remaining)
notifyFocusChangesRecur(items + 1, remaining - 1);
#include "qquickitem.h"
#include "qquickwindow.h"
-#include <private/qqmlguard_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qquickdrag_p.h>
#include <QtCore/qwaitcondition.h>
#include <private/qsgadaptationlayer_p.h>
-#include <private/qqmlguard_p.h>
QT_BEGIN_NAMESPACE
Owner(const Owner &o) : item(o.item), ref(o.ref) {}
Owner &operator =(const Owner &o) { item = o.item; ref = o.ref; return *this; }
- QQmlGuard<QQuickItem> item;
+ QPointer<QQuickItem> item;
int ref;
};
#include <qqmlcontext.h>
#include <qqmlinfo.h>
#include <private/qqmlproperty_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qqmlengine_p.h>
#include <private/qabstractanimationjob_p.h>
#include <private/qquicktransition_p.h>
QQmlProperty property;
QVariant targetValue;
- QQmlGuard<QQuickAbstractAnimation> animation;
+ QPointer<QQuickAbstractAnimation> animation;
QAbstractAnimationJob *animationInstance;
bool enabled;
bool finalized;
#include <qqmlexpression.h>
#include <private/qqmlbinding_p.h>
#include <qqmlcontext.h>
-#include <private/qqmlguard_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qqmlcontext_p.h>
#include <private/qquickstate_p_p.h>
QQuickPropertyChangesPrivate() : decoded(true), restore(true),
isExplicit(false) {}
- QQmlGuard<QObject> object;
+ QPointer<QObject> object;
QByteArray data;
bool decoded : 1;
#include <qqmlcontext.h>
#include <qqmlexpression.h>
#include <qqmlinfo.h>
-#include <private/qqmlguard_p.h>
#include <private/qqmlcontext_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qqmlbinding_p.h>
#include <QtQml/qqmlcontext.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdebug.h>
-#include <QtQml/private/qqmlguard_p.h>
#include <QtCore/qdir.h>
#include <QtCore/qnumeric.h>
#include <private/qqmlengine_p.h>
{
{
QQmlComponent component(&engine, testFileUrl("dynamicDeletion.qml"));
- QQmlGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create());
+ QPointer<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
- QQmlGuard<QObject> createdQmlObject = 0;
+ QPointer<QObject> createdQmlObject = 0;
QMetaObject::invokeMethod(object, "create");
createdQmlObject = object->objectProperty();
{
// QTBUG-23451
- QQmlGuard<QObject> createdQmlObject = 0;
+ QPointer<QObject> createdQmlObject = 0;
QQmlComponent component(&engine, testFileUrl("dynamicDeletion.3.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
context->setContextObject(&own);
QQmlComponent component(&engine, testFileUrl("ownershipRootObject.qml"));
- QQmlGuard<QObject> object = component.create(context);
+ QPointer<QObject> object = component.create(context);
QVERIFY(object);
engine.collectGarbage();
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QQmlComponent component(&engine, testFileUrl("ownershipConsistency.qml"));
- QQmlGuard<QObject> object = component.create(context);
+ QPointer<QObject> object = component.create(context);
QVERIFY(object);
engine.collectGarbage();
delete object;
}
-// Verifies that QQmlGuard<>s used in the vmemetaobject are cleaned correctly
+// Verifies that QPointer<>s used in the vmemetaobject are cleaned correctly
void tst_qqmlecmascript::qtcreatorbug_1289()
{
QQmlComponent component(&engine, testFileUrl("qtcreatorbug_1289.qml"));