diff options
-rwxr-xr-x | config.profiles/harmattan/tests/create_tests_xml | 2 | ||||
-rw-r--r-- | config.profiles/harmattan/tests/maemo_tests.prf | 2 | ||||
-rw-r--r-- | examples/declarative/righttoleft/layoutdirection/layoutdirection.qml | 2 | ||||
-rw-r--r-- | examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml | 2 | ||||
-rw-r--r-- | examples/declarative/righttoleft/textalignment/textalignment.qml | 2 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 22 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface_qpa.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface_qpa.h | 2 | ||||
-rw-r--r-- | tests/auto/qpointer/tst_qpointer.cpp | 110 | ||||
-rw-r--r-- | tests/auto/xmlpatterns/stderrBaselines/Passhelp.txt | 16 | ||||
-rw-r--r-- | tools/qtconfig/paletteeditoradvanced.ui | 2 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.ui | 2 |
12 files changed, 64 insertions, 102 deletions
diff --git a/config.profiles/harmattan/tests/create_tests_xml b/config.profiles/harmattan/tests/create_tests_xml index d6122bc..f872633 100755 --- a/config.profiles/harmattan/tests/create_tests_xml +++ b/config.profiles/harmattan/tests/create_tests_xml @@ -2,7 +2,7 @@ ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/config.profiles/harmattan/tests/maemo_tests.prf b/config.profiles/harmattan/tests/maemo_tests.prf index 1b87781..5608cd7 100644 --- a/config.profiles/harmattan/tests/maemo_tests.prf +++ b/config.profiles/harmattan/tests/maemo_tests.prf @@ -1,6 +1,6 @@ ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml index b4efebe..3044430 100644 --- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml +++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml index 0d1b871..b4065ba 100644 --- a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml +++ b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/declarative/righttoleft/textalignment/textalignment.qml b/examples/declarative/righttoleft/textalignment/textalignment.qml index 4c40c3c..afd2d68 100644 --- a/examples/declarative/righttoleft/textalignment/textalignment.qml +++ b/examples/declarative/righttoleft/textalignment/textalignment.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index b1f77b4..95256fb 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -85,7 +85,7 @@ reference count (i.e., a reference counter placed outside the object). Like its name indicates, the pointer value is shared among all instances of QSharedPointer and QWeakPointer. The - contents of the object pointed to by the pointer should not + contents of the object pointed to by the pointer should not be considered shared, however: there is only one object. For that reason, QSharedPointer does not provide a way to detach or make copies of the pointed object. @@ -151,7 +151,7 @@ QtSharedPointer::ExternalRefCount implements the actual reference counting and introduces the d-pointer for QSharedPointer. That d-pointer - itself is shared with with other QSharedPointer objects as well as + itself is shared with other QSharedPointer objects as well as QWeakPointer. The reason for keeping the pointer value itself outside the d-pointer is @@ -213,7 +213,7 @@ destroyer field must be set to a valid function that \b will delete the object tracked. - This class also adds an operator delete function to ensure that simply + This class also adds an operator delete function to ensure that it simply calls the global operator delete. That should be the behaviour in all compilers already, but to be on the safe side, this class ensures that no funny business happens. @@ -308,7 +308,7 @@ When initialising the parent class, the create() functions pass the address of the static deleter() member function. That is, when the virtual destroy() is called by QSharedPointer, the deleter() functions - are called instead. These functiosn static_cast the ExternalRefCountData* + are called instead. These functions static_cast the ExternalRefCountData* parameter to their own type and execute their deletion: for the ExternalRefCountWithCustomDeleter::deleter() case, it runs the user's custom deleter, then destroys the deleter; for @@ -318,7 +318,7 @@ By not calling the constructor of the derived classes, we avoid instantiating their virtual tables. Since these classes are template-based, there would be one virtual table per \tt T and \tt - Deleter type. (This is what Qt 4.5 did) + Deleter type. (This is what Qt 4.5 did.) Instead, only one non-inline function is required per template, which is the deleter() static member. All the other functions can be inlined. @@ -381,7 +381,7 @@ first promote it to QSharedPointer and verify if the resulting object is null or not. QSharedPointer guarantees that the object isn't deleted, so if you obtain a non-null object, you may use the pointer. See - QWeakPointer::toStrongRef() for more an example. + QWeakPointer::toStrongRef() for an example. QWeakPointer also provides the QWeakPointer::data() method that returns the tracked pointer without ensuring that it remains valid. This function @@ -395,7 +395,7 @@ \section1 Tracking QObject - QWeakPointer can be used to track deletion classes that derive from QObject, + QWeakPointer can be used to track deletion of classes that derive from QObject, even if they are not managed by QSharedPointer. When used in that role, QWeakPointer replaces the older QPointer in all use-cases. QWeakPointer is also more efficient than QPointer, so it should be preferred in all @@ -483,9 +483,9 @@ another QSharedPointer object or deleted outside this object. The \a deleter parameter specifies the custom deleter for this - object. The custom deleter is called when the strong reference - count drops to 0 instead of the operator delete(). This is useful, - for instance, for calling deleteLater() in a QObject instead: + object. The custom deleter is called, instead of the operator delete(), + when the strong reference count drops to 0. This is useful, + for instance, for calling deleteLater() on a QObject instead: \code static void doDeleteLater(MyObject *obj) @@ -754,7 +754,7 @@ \fn QWeakPointer &QWeakPointer::operator=(const QObject *obj) \since 4.6 - Makes this QWeakPointer hold a weak reference to directly to the QObject + Makes this QWeakPointer hold a weak reference directly to the QObject \a obj. This function is only available if the template type \tt T is QObject or derives from it. diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index ace4a7b..281aeba 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index 5ea2c13..b9d0619 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qpointer/tst_qpointer.cpp b/tests/auto/qpointer/tst_qpointer.cpp index 0485a17..67579fd 100644 --- a/tests/auto/qpointer/tst_qpointer.cpp +++ b/tests/auto/qpointer/tst_qpointer.cpp @@ -39,11 +39,8 @@ ** ****************************************************************************/ - #include <QtTest/QtTest> -#include <QApplication> -#include <QDebug> #include <QPointer> #include <QWidget> @@ -51,17 +48,9 @@ class tst_QPointer : public QObject { Q_OBJECT public: - tst_QPointer(); - ~tst_QPointer(); - inline tst_QPointer *me() const { return const_cast<tst_QPointer *>(this); } -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); private slots: void constructors(); void destructor(); @@ -71,29 +60,9 @@ private slots: void dereference_operators(); void disconnect(); void castDuringDestruction(); - void data() const; - void dataSignature() const; void threadSafety(); }; -tst_QPointer::tst_QPointer() -{ } - -tst_QPointer::~tst_QPointer() -{ } - -void tst_QPointer::initTestCase() -{ } - -void tst_QPointer::cleanupTestCase() -{ } - -void tst_QPointer::init() -{ } - -void tst_QPointer::cleanup() -{ } - void tst_QPointer::constructors() { QPointer<QObject> p1; @@ -106,11 +75,20 @@ void tst_QPointer::constructors() void tst_QPointer::destructor() { + // Make two QPointer's to the same object QObject *object = new QObject; - QPointer<QObject> p = object; - QCOMPARE(p, QPointer<QObject>(object)); + QPointer<QObject> p1 = object; + QPointer<QObject> p2 = object; + // Check that they point to the correct object + QCOMPARE(p1, QPointer<QObject>(object)); + QCOMPARE(p2, QPointer<QObject>(object)); + QCOMPARE(p1, p2); + // Destroy the guarded object delete object; - QCOMPARE(p, QPointer<QObject>(0)); + // Check that both pointers were zeroed + QCOMPARE(p1, QPointer<QObject>(0)); + QCOMPARE(p2, QPointer<QObject>(0)); + QCOMPARE(p1, p2); } void tst_QPointer::assignment_operators() @@ -118,19 +96,21 @@ void tst_QPointer::assignment_operators() QPointer<QObject> p1; QPointer<QObject> p2; + // Test assignment with a QObject-derived object pointer p1 = this; p2 = p1; - QCOMPARE(p1, QPointer<QObject>(this)); QCOMPARE(p2, QPointer<QObject>(this)); QCOMPARE(p1, QPointer<QObject>(p2)); + // Test assignment with a null pointer p1 = 0; p2 = p1; QCOMPARE(p1, QPointer<QObject>(0)); QCOMPARE(p2, QPointer<QObject>(0)); QCOMPARE(p1, QPointer<QObject>(p2)); + // Test assignment with a real QObject pointer QObject *object = new QObject; p1 = object; @@ -139,10 +119,15 @@ void tst_QPointer::assignment_operators() QCOMPARE(p2, QPointer<QObject>(object)); QCOMPARE(p1, QPointer<QObject>(p2)); - delete object; - QCOMPARE(p1, QPointer<QObject>(0)); - QCOMPARE(p2, QPointer<QObject>(0)); + // Test assignment with the same pointer that's already guarded + p1 = object; + p2 = p1; + QCOMPARE(p1, QPointer<QObject>(object)); + QCOMPARE(p2, QPointer<QObject>(object)); QCOMPARE(p1, QPointer<QObject>(p2)); + + // Cleanup + delete object; } void tst_QPointer::equality_operators() @@ -196,19 +181,28 @@ void tst_QPointer::isNull() void tst_QPointer::dereference_operators() { QPointer<tst_QPointer> p1 = this; + QPointer<tst_QPointer> p2; + // operator->() -- only makes sense if not null QObject *object = p1->me(); - QVERIFY(object == this); + QCOMPARE(object, this); + // operator*() -- only makes sense if not null QObject &ref = *p1; - QVERIFY(&ref == this); + QCOMPARE(&ref, this); + + // operator T*() + QCOMPARE(static_cast<QObject *>(p1), this); + QCOMPARE(static_cast<QObject *>(p2), static_cast<QObject *>(0)); - object = static_cast<QObject *>(p1); - QVERIFY(object == this); + // data() + QCOMPARE(p1.data(), this); + QCOMPARE(p2.data(), static_cast<QObject *>(0)); } void tst_QPointer::disconnect() { + // Verify that pointer remains guarded when all signals are disconencted. QPointer<QObject> p1 = new QObject; QVERIFY(!p1.isNull()); p1->disconnect(); @@ -314,38 +308,6 @@ void tst_QPointer::castDuringDestruction() } } -void tst_QPointer::data() const -{ - /* Check value of a default constructed object. */ - { - QPointer<QObject> p; - QCOMPARE(p.data(), static_cast<QObject *>(0)); - } - - /* Check value of a default constructed object. */ - { - QObject *const object = new QObject(); - QPointer<QObject> p(object); - QCOMPARE(p.data(), object); - } -} - -void tst_QPointer::dataSignature() const -{ - /* data() should be const. */ - { - const QPointer<QObject> p; - p.data(); - } - - /* The return type should be T. */ - { - const QPointer<QWidget> p; - /* If the types differs, the QCOMPARE will fail to instansiate. */ - QCOMPARE(p.data(), static_cast<QWidget *>(0)); - } -} - class TestRunnable : public QObject, public QRunnable { void run() { QPointer<QObject> obj1 = new QObject; diff --git a/tests/auto/xmlpatterns/stderrBaselines/Passhelp.txt b/tests/auto/xmlpatterns/stderrBaselines/Passhelp.txt index 4e789e7..4a86f75 100644 --- a/tests/auto/xmlpatterns/stderrBaselines/Passhelp.txt +++ b/tests/auto/xmlpatterns/stderrBaselines/Passhelp.txt @@ -1,28 +1,28 @@ xmlpatterns -- A tool for running XQuery queries. - - When appearing, any following options are not + - When appearing, any following options are not interpreted as switches. -help Displays this help. - -initial-template <string> The name of the initial template to call as a + -initial-template <string> The name of the initial template to call as a Clark Name. - -is-uri If specified, all filenames on the command line + -is-uri If specified, all filenames on the command line are interpreted as URIs instead of a local filenames. - -no-format By default output is formatted for readability. + -no-format By default output is formatted for readability. When specified, strict serialization is performed. - -output <local file> A local file to which the output should be + -output <local file> A local file to which the output should be written. The file is overwritten, or if not exist, created. If absent, stdout is used. - -param <name=value> Binds an external variable. The value is + -param <name=value> Binds an external variable. The value is directly available using the variable reference: $name. -version Displays version information. - focus <string> The document to use as focus. Mandatory in case + focus <string> The document to use as focus. Mandatory in case a stylesheet is used. This option is also affected by the is-uris option. - query/stylesheet <string> A local filename pointing to the query to run. + query/stylesheet <string> A local filename pointing to the query to run. If the name ends with .xsl it's assumed to be an XSL-T stylesheet. If it ends with .xq, it's assumed to be an XQuery query. (In other cases diff --git a/tools/qtconfig/paletteeditoradvanced.ui b/tools/qtconfig/paletteeditoradvanced.ui index b1d6b95..0b4ae66 100644 --- a/tools/qtconfig/paletteeditoradvanced.ui +++ b/tools/qtconfig/paletteeditoradvanced.ui @@ -2,7 +2,7 @@ <ui version="4.0"> <comment>********************************************************************* ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qtconfig/previewwidget.ui b/tools/qtconfig/previewwidget.ui index 2e0789f..fac4b6c 100644 --- a/tools/qtconfig/previewwidget.ui +++ b/tools/qtconfig/previewwidget.ui @@ -2,7 +2,7 @@ <ui version="4.0"> <comment>********************************************************************* ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** |