From b63fa9907a3299f6b9ce158b153941be2b666cc9 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 18 Feb 2011 16:37:11 +0000 Subject: Fix threadstorage test The test was not calling the destructor in the test class because the global static was defined before the destructor was declared. Task-number: QTBUG-13990 Reviewed-by: Shane Kearns --- tests/auto/qthreadstorage/tst_qthreadstorage.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp index a62bfee..2391c81 100644 --- a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp @@ -385,19 +385,18 @@ void tst_QThreadStorage::QTBUG14579_leakInDestructor() QCOMPARE(int(SPointer::count), c); } - -class QTBUG14579_reset; -Q_GLOBAL_STATIC(QThreadStorage, QTBUG14579_resetTls) - class QTBUG14579_reset { public: SPointer member; - ~QTBUG14579_reset() { - //Quite stupid, but WTF::ThreadSpecific::destroy does it. - QTBUG14579_resetTls()->setLocalData(this); - } + ~QTBUG14579_reset(); }; +Q_GLOBAL_STATIC(QThreadStorage, QTBUG14579_resetTls) + +QTBUG14579_reset::~QTBUG14579_reset() { + //Quite stupid, but WTF::ThreadSpecific::destroy does it. + QTBUG14579_resetTls()->setLocalData(this); +} void tst_QThreadStorage::QTBUG14579_resetInDestructor() { -- cgit v0.12