BUG: Fixed segfault when CABLE_PACKAGE is only CABLE command. Related to order of virtual destructor calls.

This commit is contained in:
Brad King 2001-03-15 10:42:43 -05:00
parent d3735b65d6
commit 354992c522
2 changed files with 19 additions and 2 deletions

View File

@ -16,6 +16,23 @@
#include "cmCablePackageCommand.h"
#include "cmCacheManager.h"
cmCablePackageCommand::~cmCablePackageCommand()
{
// If we are the owner of the cmCableData, we must delete it here.
// For most cmCableCommands, the cmCableCommand destructor will take
// care of this. If this package happens to be the last one, and is
// the owner, then the destructor of cmCableData will call back to a method
// in this class after the package part of it has been freed!
if(m_CableData && m_CableData->OwnerIs(this))
{
delete m_CableData;
// Make sure our superclass's destructor doesn't try to delete the
// cmCableData too.
m_CableData = NULL;
}
}
// cmCablePackageCommand
bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
{

View File

@ -30,7 +30,7 @@ class cmCablePackageCommand : public cmCableCommand
{
public:
cmCablePackageCommand() {}
virtual ~cmCablePackageCommand() {}
virtual ~cmCablePackageCommand();
/**
* This is a virtual constructor for the command.