Skip to content
  • David C. Lonie's avatar
    Refactor vtkDebugLeaks construction. · e5c793db
    David C. Lonie authored
    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...
    e5c793db