I think the general pattern is that WPushButtonTest calls qWait which runs the Qt event loop, processing events that have been queued from other tests.
Here's an example where GlobalTrackCache::~GlobalTrackCache is run from a deleteLater event:
[ RUN ] WPushButtonTest.QuickPressNoLatchTest
Loading resources from "/home/rryan/Code/mixxx/res/"
ControlDoublePrivate::getControl returning NULL for ( "[Controls]" , "touch_shift" )
ControlDoublePrivate::getControl returning NULL for ( "[Controls]" , "touch_shift" )
ControlDoublePrivate::getControl returning NULL for ( "[Master]" , "num_decks" )
Thread 1 "mixxx-test" received signal SIGSEGV, Segmentation fault.
0x0000000000a8ed0c in std::_Sp_counted_deleter<LibraryTest*, LibraryTest::LibraryTest()::{lambda(GlobalTrackCacheSaver*)#1}, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (this=0x1a16660)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:466
466 { _M_impl._M_del()(_M_impl._M_ptr); }
(gdb) bt
#0 0x0000000000a8ed0c in std::_Sp_counted_deleter<LibraryTest*, LibraryTest::LibraryTest()::{lambda(GlobalTrackCacheSaver*)#1}, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (this=0x1a16660)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:466
#1 0x000000000050e3e5 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1a16660) at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:150
#2 0x000000000050e39a in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7fffffffd5b0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:659
#3 0x00000000005d39a9 in std::__shared_ptr<GlobalTrackCacheSaver, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7fffffffd5a8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:925
#4 0x0000000000cbd326 in std::__shared_ptr<GlobalTrackCacheSaver, (__gnu_cxx::_Lock_policy)2>::reset (this=0x1a88078) at /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/shared_ptr_base.h:1022
#5 0x0000000000cb79f4 in GlobalTrackCache::deactivate (this=0x1a88060) at src/track/globaltrackcache.cpp:349
#6 0x0000000000cba7b6 in GlobalTrackCache::~GlobalTrackCache (this=0x1a88060) at src/track/globaltrackcache.cpp:259
#7 0x0000000000cba889 in GlobalTrackCache::~GlobalTrackCache (this=0x1a88060) at src/track/globaltrackcache.cpp:258
#8 0x00007ffff5978c20 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9 0x00007ffff62ba05c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff62bf516 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff594938b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff594b786 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x0000000000ca0e7d in QTest::qWait (ms=1) at /usr/include/x86_64-linux-gnu/qt5/QtTest/qtestsystem.h:59
#14 0x0000000000ca0698 in QTest::mouseEvent (action=QTest::MouseRelease, widget=0x18f77c0, button=Qt::LeftButton, stateKey=..., pos=..., delay=1) at /usr/include/x86_64-linux-gnu/qt5/QtTest/qtestmouse.h:161
#15 0x0000000000ca1f6f in QTestMouseEvent::simulate (this=0xcebfa90, w=0x18f77c0) at /usr/include/x86_64-linux-gnu/qt5/QtTest/qtestevent.h:127
#16 0x0000000000ca11a5 in QTestEventList::simulate (this=0xcf220e0, w=0x18f77c0) at /usr/include/x86_64-linux-gnu/qt5/QtTest/qtestevent.h:211
#17 0x0000000000c9fc8e in WPushButtonTest_QuickPressNoLatchTest_Test::TestBody (this=0xcf220b0) at src/test/wpushbutton_test.cpp:50
#18 0x0000000000e19caa in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (object=0xcf220b0, method=&virtual testing::Test::TestBody(), location=0x11c1c84 "the test body")
at lib/gtest-1.7.0/src/gtest.cc:2078
#19 0x0000000000e0aac7 in testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=0xcf220b0, method=&virtual testing::Test::TestBody(), location=0x11c1c84 "the test body") at lib/gtest-1.7.0/src/gtest.cc:2114
#20 0x0000000000df31d5 in testing::Test::Run (this=0xcf220b0) at lib/gtest-1.7.0/src/gtest.cc:2150
#21 0x0000000000df3e98 in testing::TestInfo::Run (this=0x1892aa0) at lib/gtest-1.7.0/src/gtest.cc:2326
#22 0x0000000000df4557 in testing::TestCase::Run (this=0x1892bd0) at lib/gtest-1.7.0/src/gtest.cc:2444
#23 0x0000000000dfbd11 in testing::internal::UnitTestImpl::RunAllTests (this=0x185fe40) at lib/gtest-1.7.0/src/gtest.cc:4315
#24 0x0000000000e1d28a in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x185fe40,
method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0xdfba30 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x11c2362 "auxiliary test code (environments or event listeners)")
at lib/gtest-1.7.0/src/gtest.cc:2078
#25 0x0000000000e0ce77 in testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x185fe40,
method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0xdfba30 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x11c2362 "auxiliary test code (environments or event listeners)")
at lib/gtest-1.7.0/src/gtest.cc:2114
#26 0x0000000000dfb9e3 in testing::UnitTest::Run (this=0x179c730 <testing::UnitTest::GetInstance()::instance>) at lib/gtest-1.7.0/src/gtest.cc:3926
#27 0x0000000000bd2fb1 in RUN_ALL_TESTS () at lib/gtest-1.7.0/include/gtest/gtest.h:2288
#28 0x0000000000bd2f5e in main (argc=1, argv=0x7fffffffe688) at src/test/main.cpp:33
(gdb)
I think the general pattern is that WPushButtonTest calls qWait which runs the Qt event loop, processing events that have been queued from other tests.
Here's an example where GlobalTrackCach e::~GlobalTrack Cache is run from a deleteLater event:
[ RUN ] WPushButtonTest .QuickPressNoLa tchTest rryan/Code/ mixxx/res/ " ivate:: getControl returning NULL for ( "[Controls]" , "touch_shift" ) ivate:: getControl returning NULL for ( "[Controls]" , "touch_shift" ) ivate:: getControl returning NULL for ( "[Master]" , "num_decks" )
Loading resources from "/home/
ControlDoublePr
ControlDoublePr
ControlDoublePr
Thread 1 "mixxx-test" received signal SIGSEGV, Segmentation fault. counted_ deleter< LibraryTest* , LibraryTest: :LibraryTest( )::{lambda( GlobalTrackCach eSaver* )#1}, std::allocator< void>, (__gnu_ cxx::_Lock_ policy) 2>::_M_ dispose( ) (this=0x1a16660) ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:466 _M_del( )(_M_impl. _M_ptr) ; } counted_ deleter< LibraryTest* , LibraryTest: :LibraryTest( )::{lambda( GlobalTrackCach eSaver* )#1}, std::allocator< void>, (__gnu_ cxx::_Lock_ policy) 2>::_M_ dispose( ) (this=0x1a16660) ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:466 counted_ base<(_ _gnu_cxx: :_Lock_ policy) 2>::_M_ release (this=0x1a16660) at /usr/bin/ ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:150 shared_ count<( __gnu_cxx: :_Lock_ policy) 2>::~__ shared_ count (this=0x7ffffff fd5b0) at /usr/bin/ ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:659 shared_ ptr<GlobalTrack CacheSaver, (__gnu_ cxx::_Lock_ policy) 2>::~__ shared_ ptr (this=0x7ffffff fd5a8) at /usr/bin/ ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:925 shared_ ptr<GlobalTrack CacheSaver, (__gnu_ cxx::_Lock_ policy) 2>::reset (this=0x1a88078) at /usr/bin/ ../lib/ gcc/x86_ 64-linux- gnu/5.4. 0/../.. /../../ include/ c++/5.4. 0/bits/ shared_ ptr_base. h:1022 e::deactivate (this=0x1a88060) at src/track/ globaltrackcach e.cpp:349 e::~GlobalTrack Cache (this=0x1a88060) at src/track/ globaltrackcach e.cpp:259 e::~GlobalTrack Cache (this=0x1a88060) at src/track/ globaltrackcach e.cpp:258 :event( QEvent* ) () from /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5 vate::notify_ helper( QObject* , QEvent*) () from /usr/lib/ x86_64- linux-gnu/ libQt5Widgets. so.5 :notify( QObject* , QEvent*) () from /usr/lib/ x86_64- linux-gnu/ libQt5Widgets. so.5 n::notifyIntern al(QObject* , QEvent*) () from /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5 nPrivate: :sendPostedEven ts(QObject* , int, QThreadData*) () from /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5 x86_64- linux-gnu/ qt5/QtTest/ qtestsystem. h:59 QTest:: MouseRelease, widget=0x18f77c0, button= Qt::LeftButton, stateKey=..., pos=..., delay=1) at /usr/include/ x86_64- linux-gnu/ qt5/QtTest/ qtestmouse. h:161 ::simulate (this=0xcebfa90, w=0x18f77c0) at /usr/include/ x86_64- linux-gnu/ qt5/QtTest/ qtestevent. h:127 :simulate (this=0xcf220e0, w=0x18f77c0) at /usr/include/ x86_64- linux-gnu/ qt5/QtTest/ qtestevent. h:211 _QuickPressNoLa tchTest_ Test::TestBody (this=0xcf220b0) at src/test/ wpushbutton_ test.cpp: 50 :internal: :HandleSehExcep tionsInMethodIf Supported< testing: :Test, void> (object=0xcf220b0, method=&virtual testing: :Test:: TestBody( ), location=0x11c1c84 "the test body") 1.7.0/src/ gtest.cc: 2078 :internal: :HandleExceptio nsInMethodIfSup ported< testing: :Test, void> (object=0xcf220b0, method=&virtual testing: :Test:: TestBody( ), location=0x11c1c84 "the test body") at lib/gtest- 1.7.0/src/ gtest.cc: 2114 1.7.0/src/ gtest.cc: 2150 :TestInfo: :Run (this=0x1892aa0) at lib/gtest- 1.7.0/src/ gtest.cc: 2326 :TestCase: :Run (this=0x1892bd0) at lib/gtest- 1.7.0/src/ gtest.cc: 2444 :internal: :UnitTestImpl: :RunAllTests (this=0x185fe40) at lib/gtest- 1.7.0/src/ gtest.cc: 4315 :internal: :HandleSehExcep tionsInMethodIf Supported< testing: :internal: :UnitTestImpl, bool> (object=0x185fe40, :internal: :UnitTestImpl: :*)(testing: :internal: :UnitTestImpl * const)) 0xdfba30 <testing: :internal: :UnitTestImpl: :RunAllTests( )>, location=0x11c2362 "auxiliary test code (environments or event listeners)") 1.7.0/src/ gtest.cc: 2078 :internal: :HandleExceptio nsInMethodIfSup ported< testing: :internal: :UnitTestImpl, bool> (object=0x185fe40, :internal: :UnitTestImpl: :*)(testing: :internal: :UnitTestImpl * const)) 0xdfba30 <testing: :internal: :UnitTestImpl: :RunAllTests( )>, location=0x11c2362 "auxiliary test code (environments or event listeners)") 1.7.0/src/ gtest.cc: 2114 :UnitTest: :Run (this=0x179c730 <testing: :UnitTest: :GetInstance( )::instance> ) at lib/gtest- 1.7.0/src/ gtest.cc: 3926 1.7.0/include/ gtest/gtest. h:2288 e688) at src/test/ main.cpp: 33
0x0000000000a8ed0c in std::_Sp_
at /usr/bin/
466 { _M_impl.
(gdb) bt
#0 0x0000000000a8ed0c in std::_Sp_
at /usr/bin/
#1 0x000000000050e3e5 in std::_Sp_
#2 0x000000000050e39a in std::__
#3 0x00000000005d39a9 in std::__
#4 0x0000000000cbd326 in std::__
#5 0x0000000000cb79f4 in GlobalTrackCach
#6 0x0000000000cba7b6 in GlobalTrackCach
#7 0x0000000000cba889 in GlobalTrackCach
#8 0x00007ffff5978c20 in QObject:
#9 0x00007ffff62ba05c in QApplicationPri
#10 0x00007ffff62bf516 in QApplication:
#11 0x00007ffff594938b in QCoreApplicatio
#12 0x00007ffff594b786 in QCoreApplicatio
#13 0x0000000000ca0e7d in QTest::qWait (ms=1) at /usr/include/
#14 0x0000000000ca0698 in QTest::mouseEvent (action=
#15 0x0000000000ca1f6f in QTestMouseEvent
#16 0x0000000000ca11a5 in QTestEventList:
#17 0x0000000000c9fc8e in WPushButtonTest
#18 0x0000000000e19caa in testing:
at lib/gtest-
#19 0x0000000000e0aac7 in testing:
#20 0x0000000000df31d5 in testing::Test::Run (this=0xcf220b0) at lib/gtest-
#21 0x0000000000df3e98 in testing:
#22 0x0000000000df4557 in testing:
#23 0x0000000000dfbd11 in testing:
#24 0x0000000000e1d28a in testing:
method=(bool (testing:
at lib/gtest-
#25 0x0000000000e0ce77 in testing:
method=(bool (testing:
at lib/gtest-
#26 0x0000000000dfb9e3 in testing:
#27 0x0000000000bd2fb1 in RUN_ALL_TESTS () at lib/gtest-
#28 0x0000000000bd2f5e in main (argc=1, argv=0x7fffffff
(gdb)