summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-07-15 13:08:38 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-07-15 13:08:38 (GMT)
commit8cda4ebd5611a6680cd311ff7cadfcc43c6f1686 (patch)
tree9f1813234d33b577951e21eee7d81f65c1f20769 /tests/auto/qsharedpointer/tst_qsharedpointer.cpp
parent03c01176ebf423085e56ceabcf8335ca5027a786 (diff)
parent77edce14629b665924e89b1f22f902ceb010c964 (diff)
downloadQt-8cda4ebd5611a6680cd311ff7cadfcc43c6f1686.zip
Qt-8cda4ebd5611a6680cd311ff7cadfcc43c6f1686.tar.gz
Qt-8cda4ebd5611a6680cd311ff7cadfcc43c6f1686.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: bin/syncqt src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h src/3rdparty/webkit/WebCore/page/FrameView.cpp src/3rdparty/webkit/WebCore/page/FrameView.h src/3rdparty/webkit/WebCore/platform/ScrollView.cpp src/3rdparty/webkit/WebCore/platform/ScrollView.h src/corelib/plugin/quuid.cpp src/gui/dialogs/qfontdialog.cpp src/multimedia/audio/qaudiodevicefactory.cpp src/opengl/qgl.cpp src/openvg/qpaintengine_vg.cpp tests/auto/qxmlquery/tst_qxmlquery.cpp
Diffstat (limited to 'tests/auto/qsharedpointer/tst_qsharedpointer.cpp')
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 4e23cb1..6b4904f 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -95,6 +95,8 @@ private slots:
void creating();
void creatingQObject();
void mixTrackingPointerCode();
+ void reentrancyWhileDestructing();
+
void threadStressTest_data();
void threadStressTest();
void map();
@@ -1870,6 +1872,60 @@ void tst_QSharedPointer::invalidConstructs()
}
}
+namespace QTBUG11730 {
+ struct IB
+ {
+ virtual ~IB() {}
+ };
+
+ struct IA
+ {
+ virtual QSharedPointer<IB> getB() = 0;
+ };
+
+ struct B: public IB
+ {
+ IA *m_a;
+ B(IA *a_a) :m_a(a_a)
+ { }
+ ~B()
+ {
+ QSharedPointer<IB> b = m_a->getB();
+ }
+ };
+
+ struct A: public IA
+ {
+ QSharedPointer<IB> b;
+
+ virtual QSharedPointer<IB> getB()
+ {
+ return b;
+ }
+
+ A()
+ {
+ b = QSharedPointer<IB>(new B(this));
+ }
+
+ ~A()
+ {
+ b.clear();
+ }
+ };
+}
+
+void tst_QSharedPointer::reentrancyWhileDestructing()
+{
+ // this bug is about recursing back into QSharedPointer::clear()
+ // from inside it
+ // that is, the destructor of the object being deleted recurses
+ // into the same QSharedPointer object.
+ // First reported as QTBUG-11730
+ QTBUG11730::A obj;
+}
+
+
QTEST_MAIN(tst_QSharedPointer)
#include "tst_qsharedpointer.moc"