In windows you cannot allocate and delete data across
dll boundaries. Doing so will likely cause a crash.
This is relevant when using cppunit_dll.
CPPUNIT_NS_BEGIN::TestSuite have CPPUNIT_NS_BEGIN::Test
objects added via the CPPUNIT_TEST macro. This macro
allocated memory in the code to be tested, and is thus
in a different dll/exe to the cppunit code. When
cppunit deletes this memory in
causes memory corruption (it caused the program to
crash on my computer (Windows 2000) in release builds).
Similarly in CPPUNIT_NS_BEGIN::TextTestRunner (and
presumably other runners) outputters allocated in
different modules are deleted in the cppunit dll,
causing a crash.
Simple fix is to not delete the CPPUNIT_NS_BEGIN::Test
and CPPUNIT_NS_BEGIN::Outputter items, resulting in a
As a general rule of thumb, always design code such
that data is deleted by the same object / location that
Log in to post a comment.