summaryrefslogtreecommitdiff
path: root/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2004-06-18 10:27:53 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2004-06-18 10:27:53 +0000
commita2bd285d03987d8f4358523151543554a152324d (patch)
tree87a5706603f14d44de8037402ea173604a84ba8b /src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
parent19ca7a3dced278cbc1144c6414a51f26ce92bdc8 (diff)
downloadcppunit-a2bd285d03987d8f4358523151543554a152324d.tar.gz
Src/msvc6/testrunner/TestRunnerDlg.
src/msvc6/testrunner/TestRunnerDlg.h: * src/msvc6/testrunner/TestRunnerDlg.cpp: * src/msvc6/testpluginrunner/TestPlugIn.cpp: * src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp: * src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp: * src/msvc6/testpluginrunner/TestPlugInRunnerModel.h: bug #952912, memory leaks when loading/reloading plug-ins.
Diffstat (limited to 'src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp')
-rw-r--r--src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
index 71ae0cf..13418d3 100644
--- a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
+++ b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
@@ -9,6 +9,12 @@
#include <cppunit/TestSuite.h>
#include "TestPlugIn.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
TestPlugInRunnerModel::TestPlugInRunnerModel() :
TestRunnerModel( new CPPUNIT_NS::TestSuite( "Default" ) ),
@@ -19,6 +25,7 @@ TestPlugInRunnerModel::TestPlugInRunnerModel() :
TestPlugInRunnerModel::~TestPlugInRunnerModel()
{
+ freeRootTest();
delete m_plugIn;
}
@@ -26,6 +33,7 @@ TestPlugInRunnerModel::~TestPlugInRunnerModel()
void
TestPlugInRunnerModel::setPlugIn( TestPlugIn *plugIn )
{
+ freeRootTest();
delete m_plugIn;
m_plugIn = plugIn;
reloadPlugIn();
@@ -39,6 +47,7 @@ TestPlugInRunnerModel::reloadPlugIn()
{
CWaitCursor waitCursor;
m_history.clear();
+ freeRootTest();
setRootTest( m_plugIn->makeTest() );
loadHistory();
@@ -50,3 +59,19 @@ TestPlugInRunnerModel::reloadPlugIn()
throw;
}
}
+
+
+void
+TestPlugInRunnerModel::freeRootTest()
+{
+ delete m_rootTest;
+ m_rootTest = 0;
+}
+
+
+void
+TestPlugInRunnerModel::setRootTest( CPPUNIT_NS::Test *rootTest )
+{
+ freeRootTest();
+ TestRunnerModel::setRootTest( rootTest );
+}