From ffb2c0c0e5ff92a1611dba3de3fc11ce3f3cbe63 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Feb 2005 16:19:09 -0500 Subject: [PATCH] BUG: cmSourceFile instances should delete their own custom commands when a new one is set. --- Source/cmMakefile.cxx | 4 ---- Source/cmSourceFile.cxx | 9 +++++++++ Source/cmSourceFile.h | 5 ++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cd3b4ded2..62a1e7c6b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -701,10 +701,6 @@ AddCustomCommandToOutput(const char* outputIn, } if(file) { - if (file->GetCustomCommand()) - { - delete file->GetCustomCommand(); - } file->SetCustomCommand(cc); } } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index ed8d63f3c..6fac02440 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -201,3 +201,12 @@ bool cmSourceFile::GetPropertyAsBool(const char* prop) const } return false; } + +void cmSourceFile::SetCustomCommand(cmCustomCommand* cc) +{ + if(m_CustomCommand) + { + delete m_CustomCommand; + } + m_CustomCommand = cc; +} diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 7607fe2d7..ea7839752 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -38,7 +38,7 @@ public: } ~cmSourceFile() { - if (m_CustomCommand) { delete m_CustomCommand; } + this->SetCustomCommand(0); } /** @@ -56,8 +56,7 @@ public: const cmCustomCommand *GetCustomCommand() const {return m_CustomCommand;} cmCustomCommand *GetCustomCommand() {return m_CustomCommand;} - void SetCustomCommand(cmCustomCommand *cc) - { m_CustomCommand = cc;} + void SetCustomCommand(cmCustomCommand *cc); /** * Set the name of the file, given the directory the file should be in. IN