Refactor vtkDebugLeaks construction.
vtkDebugLeaks registers instance by class name, which worked well for many years. However, now that we have more templated code, this is becoming difficult. For instance, "template <typename T> vtkBuffer<T>" would be identified as "vtkBuffer<T>" when registering with vtkDebugLeaks, but deregistered with the compiler dependent typeid(vtkBuffer<T>).name() string returned from GetClassName(). This patch moves vtkDebugLeaks registrations to the method vtkObjectBase::InitializeObjectBase(), which must be called after the vtkObjectBase is instantiated. This ensures that objects are registered using the same string as when they are destroyed. In general, a call to "new vtkSomeClass" must be followed by a call to InitializeObjectBase on the new instance. The common ::New() implementation macros in vtkObjectFactory will ensure that registration happens correctly. Two notable exceptions are vtkCommand and vtkInformationKey subclasses. These do not require any specific handling for vtkDebugLeaks registration. See discussion at: http://vtk.1045678.n5.nabble.com/Proposal-Simplify-vtkDebugLeaks-registration-td5740222.html
Showing with 192 additions and 242 deletions