BUG: cmSourceFile instances should delete their own custom commands when a new one is set.

This commit is contained in:
Brad King 2005-02-18 16:19:09 -05:00
parent 04b5d1613c
commit ffb2c0c0e5
3 changed files with 11 additions and 7 deletions

View File

@ -701,10 +701,6 @@ AddCustomCommandToOutput(const char* outputIn,
} }
if(file) if(file)
{ {
if (file->GetCustomCommand())
{
delete file->GetCustomCommand();
}
file->SetCustomCommand(cc); file->SetCustomCommand(cc);
} }
} }

View File

@ -201,3 +201,12 @@ bool cmSourceFile::GetPropertyAsBool(const char* prop) const
} }
return false; return false;
} }
void cmSourceFile::SetCustomCommand(cmCustomCommand* cc)
{
if(m_CustomCommand)
{
delete m_CustomCommand;
}
m_CustomCommand = cc;
}

View File

@ -38,7 +38,7 @@ public:
} }
~cmSourceFile() ~cmSourceFile()
{ {
if (m_CustomCommand) { delete m_CustomCommand; } this->SetCustomCommand(0);
} }
/** /**
@ -56,8 +56,7 @@ public:
const cmCustomCommand *GetCustomCommand() const const cmCustomCommand *GetCustomCommand() const
{return m_CustomCommand;} {return m_CustomCommand;}
cmCustomCommand *GetCustomCommand() {return m_CustomCommand;} cmCustomCommand *GetCustomCommand() {return m_CustomCommand;}
void SetCustomCommand(cmCustomCommand *cc) void SetCustomCommand(cmCustomCommand *cc);
{ m_CustomCommand = cc;}
/** /**
* Set the name of the file, given the directory the file should be in. IN * Set the name of the file, given the directory the file should be in. IN