Small Bug in vtkSetStringMacro
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
In the vtkSetStringMacro there seems to be a small Bug.
When the Debug flag is on the argument _arg will be sent to the ostream. This is not bad until the macro is beeing called with _arg == NULL. This seems to be the case i.e. in the destructor of vtkXMLWriter.
The following is from Common/vtkSetGet.h :
#define vtkSetStringMacro(name)
virtual void Set##name (const char* _arg)
{
vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg );
if ( this->name == NULL && _arg == NULL) { return;}
if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;}
if (this->name) { delete [] this->name; }
if (_arg)
{
this->name = new char[strlen(_arg)+1];
strcpy(this->name,_arg);
}
else
{
this->name = NULL;
}
this->Modified();
}
Best regards, Roland