summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Reimplement qSwap and Q_DECLARE_SHARED differently.Thiago Macieira2009-08-141-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | This enables the use of Q_DECLARE_SHARED with d-pointers that are QExplicitlySharedDataPointer<PrivateClass>. Also, this enables swapping atomically QSharedPointers. Reviewed-by: Harald Fernengel
* | | Merge commit 'qt/master'Jason Barron2009-08-138-8/+25
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/samplebuffers/glwidget.cpp src/corelib/io/qfsfileengine_unix.cpp src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer.cpp src/gui/gui.pro tests/auto/qhttp/tst_qhttp.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp
| * | Autotest: make sure we can't create QWeakPointer from a QObject in destruction.Thiago Macieira2009-08-121-0/+15
| | | | | | | | | | | | This test only works in debug mode
| * | Update contact URL in license headers.Jason McDonald2009-08-128-8/+8
| | | | | | | | | | | | Reviewed-by: Trust Me
| * | tst_QSharedPointer fixed for Windows CEJoerg Bornemann2009-08-101-0/+2
| | | | | | | | | | | | | | | | | | We cannot create too many threads on Windows CE. Reviewed-By: thartman
* | | Merge commit 'qt/master-stable'Jason Barron2009-08-101-0/+145
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer_impl.h src/gui/widgets/qdatetimeedit.cpp src/gui/widgets/qlinecontrol.cpp src/gui/widgets/qlineedit.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qicoimageformat/tst_qicoimageformat.cpp tests/auto/qmultiscreen/qmultiscreen.pro tests/auto/qresourceengine/qresourceengine.pro tests/auto/qresourceengine/tst_qresourceengine.cpp tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
| * | tst_qsharedpointer compile fix for Windows CEJoerg Bornemann2009-08-061-0/+4
| | | | | | | | | | | | | | | | | | There's no time() on Windows CE. Reviewed-by: Daniel Molkentin
| * | Restore symmetry between QSharedPointer and QWeakPointer on QObjects.Thiago Macieira2009-08-051-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the previous commit, you could create a QWeakPointer from any QObject-derived object. It's possible because QObject now has a pointer to the QWeakPointer's d-pointer. However, if you did: QSharedPointer<QObject> obj(new QObject); QWeakPointer<QObject> weak1(obj); QWeakPointer<QObject> weak2(obj.data()); Then weak1 would shared d-pointers with QSharedPointer, but weak2 wouldn't. Also, weak1.toStrongRef() would work, but weak2.toStrongRef() wouldn't. This change makes QObject know where the d-pointer created by QSharedPointer is, so weak2 would get the same d-pointer. As a nice side-effect, you can check if a given QObject is shared by trying to promote its QWeakPointer to QSharedPointer. Reviewed-by: Bradley T. Hughes
| * | Add support for using QWeakPointer with QObject, replacing QPointer.Thiago Macieira2009-08-051-0/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem with QPointer is that it's a simple QObject*. So the only way for QPointer to do what it's supposed to do is if the object it's pointing to clears all QPointers when getting deleted. That means the QObject must know each and every QPointer pointing to it. To make matters worse, QPointers can be deleted while the object they're pointing to also gets deleted. So deleting QObjects must do locking. The solution to the QPointer problem is that both QObject and the "QPointer" reference something outside the QObject. This way, QObject doesn't have to lock anything to destroy itself: it's simply setting a volatile integer to zero when it gets deleted. Since the integer is outside the QObject, the integer is also refcounted. It's also O(1), so there's no problem having as many "QPointer". The two-atomic-ints structure is exactly what QSharedPointer and QWeakPointer use internally. We just abuse this structure for QObject needs, setting the strong reference count to -1 to indicate that it's a QObject that cannot be managed by a QSharedPointer. But QWeakPointer can still work and replace QPointer neatly. Reviewed-by: Bradley T. Hughes Reviewed-by: Jarek Kobus
* | | Merge commit 'qt/master-stable'Jason Barron2009-08-044-43/+380
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/openssl/openssl.pri demos/embedded/embedded.pro examples/itemviews/chart/chart.pro examples/network/network.pro examples/painting/painterpaths/painterpaths.pro examples/threads/mandelbrot/mandelbrot.pro qmake/project.cpp src/3rdparty/libtiff/libtiff/tif_config.h src/corelib/arch/arch.pri src/corelib/global/qglobal.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qcore_unix_p.h src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/corelib/tools/qsharedpointer_impl.h src/corelib/tools/tools.pri src/gui/kernel/qaction.h src/gui/kernel/qapplication.cpp src/gui/painting/qregion.h src/gui/widgets/qlineedit.cpp src/gui/widgets/qlineedit_p.h src/network/socket/qnativesocketengine_unix.cpp tests/auto/qdir/tst_qdir.cpp tests/auto/qdiriterator/tst_qdiriterator.cpp tests/auto/qhttp/qhttp.pro tests/auto/qline/qline.pro tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qresourceengine/qresourceengine.pro tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qstring/qstring.pro tests/auto/qtcpsocket/qtcpsocket.pro tests/auto/qtcpsocket/tst_qtcpsocket.cpp
| * | Ensure that we never increase the strong reference count up from zero.Thiago Macieira2009-08-031-1/+124
| | | | | | | | | | | | | | | | | | Also add some thread stress tests to try and detect doing it wrong. Reviewed-By: Bradley T. Hughes
| * | Change the pointer-tracking code to work everywhere.Thiago Macieira2009-08-034-2/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, if you create a QSharedPointer in code with pointer-tracking, you must ensure it gets deleted in code with pointer-tracking, otherwise the internal safety tracker will be "leaking" objects. The pointers would never get removed. And if any new pointer happened to have the same pointer address (which happens quite often), the tracker code would promptly abort the application. With this change, the untracking of the pointer is scheduled by the same code that creates the tracking. This is done by "abusing" the custom deleter code: - for the QSharedPointer that used ExternalRefCountWithDestroyFn already, we intercept the call to the destroy function and call the untracking function - for a normal QSharedPointer, we use the "normalDeleter" function as custom deleter and chain up above Note: the autotest only *really* works in release mode. Otherwise functions don't get inlined and do get merged by the linker. Reviewed-By: Bradley T. Hughes
| * | Don't forget to delete the deleter object too in QSharedPointer.Thiago Macieira2009-08-031-0/+13
| | | | | | | | | | | | | | | | | | Destructors have to be run for the subobjects we initialise. Reviewed-By: Bradley T. Hughes
| * | Remove the need for internal API in QSharedPointer.Thiago Macieira2009-08-032-41/+55
| | | | | | | | | | | | | | | | | | | | | That way, this code can be compiled with an earlier version of Qt and should still work in new ones. Reviewed-by: Trust Me
| * | Autotest: add a way to ensure that there are no safety-check pointers leakingThiago Macieira2009-08-031-0/+42
| | | | | | | | | | | | | | | In the future, it would be nice to split the autotest in multiple functions at every check().
| * | Merge branch '4.5'Thiago Macieira2009-08-031-0/+2
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qsharedpointer.cpp src/corelib/tools/qsharedpointer_impl.h src/gui/dialogs/qcolordialog.cpp src/gui/painting/qwindowsurface_raster.cpp src/network/access/qnetworkaccessmanager.cpp tests/auto/qsharedpointer/externaltests.cpp
| | * Autotest: disable the pointer-tracking tests in 4.5Thiago Macieira2009-08-031-0/+2
| | | | | | | | | | | | | | | | | | | | | The functionality these tests tested was broken in 4.5 and has been disabled. Therefore, these tests simply cannot pass. It's fixed in 4.6.
| | * Autotest: add a newline after the user program headers.Thiago Macieira2009-07-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | If the user forgot to end their headers with a newline, the compilation would fail because the next line is #include <QtCore/QtCore>. Reviewed-by: Jesper Thomschütz
| | * Fix a running external tests: user program headers must come first.Thiago Macieira2009-07-261-2/+2
| | | | | | | | | | | | | | | | | | No wonder QT_SHAREDPOINTER_TRACK_POINTERS was having no effect: there was an #include <QtCore/QtCore> before it. (cherry picked from commit 4c12010fac555bce0a6c8d69a267a56f4c15087f)
* | | Merge commit 'qt/master-stable'Jason Barron2009-07-301-0/+4
|\ \ \ | |/ / | | | | | | | | | | | | Conflicts: demos/demos.pro src/gui/graphicsview/qgraphicsitem_p.h
| * | Disable the forwardDeclared1 test with SunCC: it doesn't workThiago Macieira2009-07-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | I added this test because I thought that the compiler would find the forward-declarations due to the "one definition" rule. In hindsight, it's not a good idea. Sun CC warns about this, gcc doesn't. With Sun CC, the code leaks, with gcc it doesn't.
* | | Merge commit 'qt/master-stable'Jason Barron2009-07-282-14/+176
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe src/corelib/io/io.pri src/corelib/io/qfilesystemwatcher.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tools/configure/configureapp.cpp
| * | Fix a running external tests: user program headers must come first.Thiago Macieira2009-07-251-2/+2
| | | | | | | | | | | | | | | No wonder QT_SHAREDPOINTER_TRACK_POINTERS was having no effect: there was an #include <QtCore/QtCore> before it.
| * | Add support for debugging and valgrinding external testsThiago Macieira2009-07-251-10/+74
| | | | | | | | | | | | This requires modifying slightl QProcess on Unix to forward stdin too.
| * | Revert "Revert "Add support for creating the object alongside the Data ↵Thiago Macieira2009-07-241-2/+100
| | | | | | | | | | | | | | | | | | | | | structure in QSharedPointer"" This restores the original implementation of the creating function. The next commit will make it suitable for use.
* | | Merge commit 'qt/master-stable'Jason Barron2009-07-278-12/+347
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
| * | Disable private unit tests when Qt is configured withoutRohan McGovern2009-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -developer-build, part 2. Some autotests use private (unexported) code, either because they're testing private classes or because that's the easiest way to test the public classes. Configuring Qt with `-developer-build' is needed for these tests. This commit fixes the tests so configuring without `-developer-build' only builds the tests which strictly use public API.
| * | Revert "Add support for creating the object alongside the Data structure in ↵Thiago Macieira2009-07-021-100/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSharedPointer" This reverts commit fb51a10ee0451274a430227566ae26efb2ac4474. Sorry, it didn't work. I can fix the MSVC error, but the problem is that older GCC versions (4.2) fail with the following code: template<typename T> struct Buffer { char buffer[128] __attribute__((aligned(__alignof__(T)))); }; The same works fine in GCC 4.4.
| * | Experimental: allow QSharedPointer to be used with forward declarations that ↵Thiago Macieira2009-07-028-12/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are declared in this file. The one-definition rule allows the forward declaration appearing below to apply to code that was earlier. Therefore, if the compiler finds out how to delete the object, we can allow a QSharedPointer of a forward- declared-type. This means the actual problem is just a warning with g++. To catch the error, we need a separate .cpp file and I'd rather run this as an external test.
| * | Add support for creating the object alongside the Data structure inThiago Macieira2009-07-021-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | one go. This avoids one memory allocation. Currently, we only support calling the default constructors. I will *NOT* implement argument passing for C++03. I will implement it with rvalue references for C++0x-capable compilers.
| * | Add qobject_cast for QSharedPointer.Thiago Macieira2009-07-021-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | This obviously only works for classes that derive from QObject. And you must remember that QSharedPointer controls the QObject's lifetime, not the QObject parent-child relationship. Reviewed-by: dt Reviewed-by: Bradley T. Hughes
* | | Merge commit 'qt/master-stable' into 4.6-mergedJason Barron2009-06-303-10/+18
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore configure.exe src/corelib/concurrent/qtconcurrentthreadengine.h src/corelib/global/qnamespace.h src/gui/graphicsview/qgraphicssceneevent.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_p.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qwidget.h src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkaccesshttpbackend.cpp tests/auto/network-settings.h tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro tests/auto/qvariant/tst_qvariant.cpp
| * | Autotest: Fix a few test names and allow me to see the compilation errorsThiago Macieira2009-06-261-3/+10
| |/ | | | | | | Reviewed-by: TrustMe
| * Change QSharedPointer to track (or not) pointers when the #define isThiago Macieira2009-06-251-1/+2
| | | | | | | | | | | | | | | | | | enabled. This allows mixing of debug and non-debug code (possible on Unix systems) without causing assertion failures. Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
| * Update license headers as requested by the marketing department.Jason McDonald2009-06-163-6/+6
| | | | | | | | Reviewed-by: Trust Me
* | Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qtaxis2009-05-201-9/+128
|\ \ | |/ | | | | | | | | | | | | | | | | Conflicts: tests/auto/network-settings.h tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp tests/auto/qiodevice/tst_qiodevice.cpp tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp tests/auto/qsslsocket/tst_qsslsocket.cpp
| * Fix handling of dynamic casts in QSharedPointer.Thiago Macieira2009-05-181-9/+128
| | | | | | | | | | | | | | | | | | | | | | | | It's wrong to assume that static_cast<> is allowed everywhere where dynamic_cast<> is allowed. For example, if class C derives from both A and B, then you can dynamic_cast<B *>(ptr_to_A), but you can't static_cast. So introduce a helper for dynamic casts that doesn't do static_cast. Reviewed-by: Olivier Goffart
| * Long live Qt 4.5!Lars Knoll2009-03-236-0/+1735
|
* Long live Qt for S60!axis2009-04-246-0/+1744