only depending on vtk, no code to call vtk,crash when close

A mfc application use one dll, the dll depend vtk。Free library when close the app, crash in the vtk code “ delete key;“

void vtkCommonInformationKeyManager::ClassFinalize()
{

delete key;


}

how to reslove the issue, thanks for reply

Hello,

It can indeed be some unchecked delete that went unnoticed until someone just tried to load the library without actually using it like you. Perhaps you could report the bug here: https://gitlab.kitware.com/vtk/vtk/-/issues . Other than that, only taking a look at your code.

best,

PC

thanks for your reply。 i have reported the bug,expected to be handled。

The vtkCommonInformationKeyManager is meant to do cleanup of all VTK information keys when the program exits (that is, every class derived from vtkInformationKey).

In order for the cleanup to work correctly, every header file that defines a vtkInformationKey subclass must include vtkCommonInformationKeyManager.h. For example,

vtkInformationIntegerKey.h:

#include "vtkInformationKey.h"

#include "vtkCommonInformationKeyManager.h" // Manage instances of this type.

VTK_ABI_NAMESPACE_BEGIN
class VTKCOMMONCORE_EXPORT vtkInformationIntegerKey : public vtkInformationKey
{
  ...

The most likely cause of a crash in vtkCommonInformationKeyManager::ClassFinalize() is that someone created a custom information key without including vtkCommonInformationKeyManager.h. This header ensures proper cleanup via the nifti counter idiom, but if it isn’t included wherever a key is defined, it doesn’t work.

Sophia, do you know if your code defines any vtkInformationKey subclasses? Also, can you provide a full stack trace for the crash, so that we can better understand what the error was?