From e197d3f219e80be8b3c6679dc7fd8a74d1772b52 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 14 Sep 2001 16:26:56 -0400 Subject: [PATCH] remove memory leaks --- Source/MFCDialog/CMakeSetupDialog.cpp | 1 + Source/cmMakefileGenerator.cxx | 2 +- Source/cmStandardIncludes.h | 2 +- Source/cmUnixMakefileGenerator.cxx | 5 +++++ Source/cmUnixMakefileGenerator.h | 2 ++ Source/cmakemain.cxx | 5 ++++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index ebb2c0201..10c5be683 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -773,6 +773,7 @@ void CMakeSetupDialog::OnOk() { m_CacheEntriesList.ClearDirty(); this->RunCMake(true); + cmMakefileGenerator::UnRegisterGenerators(); CDialog::OnOK(); } diff --git a/Source/cmMakefileGenerator.cxx b/Source/cmMakefileGenerator.cxx index 18d86c5fe..525d152d1 100644 --- a/Source/cmMakefileGenerator.cxx +++ b/Source/cmMakefileGenerator.cxx @@ -52,7 +52,7 @@ void cmMakefileGenerator::SetMakefile(cmMakefile* mf) void cmMakefileGenerator::UnRegisterGenerators() { - for(std::map::iterator i + for(std::map::iterator i = s_RegisteredGenerators.begin(); i != s_RegisteredGenerators.end(); ++i) { diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 570dc6684..aaafcfc17 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -131,7 +131,7 @@ inline bool operator==(std::string const& a, const char* b) { return (a==std::string(b)); } # endif // end CM_SGI_CC_720 -// use this class to shring the size of symbols in .o files +// use this class to shrink the size of symbols in .o files // std::string is really basic_string<....lots of stuff....> // when combined with a map or set, the symbols can be > 2000 chars! struct cmStdString : public std::string diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 96731daad..b51f52ff0 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -53,6 +53,11 @@ cmUnixMakefileGenerator::cmUnixMakefileGenerator() m_Recurse = false; } +cmUnixMakefileGenerator::~cmUnixMakefileGenerator() +{ +} + + void cmUnixMakefileGenerator::GenerateMakefile() { // suppoirt override in output directories diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h index 03439516a..cce773a18 100644 --- a/Source/cmUnixMakefileGenerator.h +++ b/Source/cmUnixMakefileGenerator.h @@ -56,6 +56,8 @@ public: ///! Set cache only and recurse to false by default. cmUnixMakefileGenerator(); + ~cmUnixMakefileGenerator(); + ///! Get the name for the generator. virtual const char* GetName() {return "Unix Makefiles";} diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index bcc250f93..3df3d6496 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -1,4 +1,5 @@ #include "cmake.h" +#include "cmMakefileGenerator.h" int main(int ac, char** av) { @@ -8,5 +9,7 @@ int main(int ac, char** av) { args.push_back(av[i]); } - return cm.Generate(args); + int ret = cm.Generate(args); + cmMakefileGenerator::UnRegisterGenerators(); + return ret; }