| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | | |
This test only works in debug mode
|
| | |
| | |
| | |
| | | |
Reviewed-by: Trust Me
|
| | |
| | |
| | |
| | |
| | |
| | | |
We cannot create too many threads on Windows CE.
Reviewed-By: thartman
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | | |
There's no time() on Windows CE.
Reviewed-by: Daniel Molkentin
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | | |
Also add some thread stress tests to try and detect doing it wrong.
Reviewed-By: Bradley T. Hughes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | | |
Destructors have to be run for the subobjects we initialise.
Reviewed-By: Bradley T. Hughes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
That way, this code can be compiled with an earlier version of Qt and
should still work in new ones.
Reviewed-by: Trust Me
|
| | |
| | |
| | |
| | |
| | | |
In the future, it would be nice to split the autotest in multiple
functions at every check().
|
| |\ \
| | |/
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | | |
No wonder QT_SHAREDPOINTER_TRACK_POINTERS was having no effect:
there was an #include <QtCore/QtCore> before it.
(cherry picked from commit 4c12010fac555bce0a6c8d69a267a56f4c15087f)
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | | |
Conflicts:
demos/demos.pro
src/gui/graphicsview/qgraphicsitem_p.h
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
configure.exe
src/corelib/io/io.pri
src/corelib/io/qfilesystemwatcher.cpp
tests/auto/qfileinfo/tst_qfileinfo.cpp
tools/configure/configureapp.cpp
|
| | |
| | |
| | |
| | |
| | | |
No wonder QT_SHAREDPOINTER_TRACK_POINTERS was having no effect:
there was an #include <QtCore/QtCore> before it.
|
| | |
| | |
| | |
| | | |
This requires modifying slightl QProcess on Unix to forward stdin too.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
structure in QSharedPointer""
This restores the original implementation of the creating
function. The next commit will make it suitable for use.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
-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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| |/
| |
| |
| | |
Reviewed-by: TrustMe
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| | |
Reviewed-by: Trust Me
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
|
|
|