I have a class which is used to wrap DcmFileFormat. There are others methods but there are not of interest here.
Code: Select all
class CDicomFile
{
public:
//! Constructeur
CDicomFile() : m_pDcmDataset(NULL)
{ m_pFileformat = new DcmFileFormat();};
//! Destructeur
virtual ~CDicomFile()
{ delete m_pFileformat;};
protected :
// pointeur sur la structure DcmDataset interne
DcmDataset *m_pDcmDataset;
DcmFileFormat *m_pFileformat;
};
Now, when I want to delete m_pFileformat in the dtor, I get a runtime error wirth these messages from the debugger
Code: Select all
> main.exe!CheckBytes(unsigned char * pb=0x01442244, unsigned char bCheck='í', unsigned int nSize=3) Ligne 1595 + 0x7 octets C++
main.exe!_free_dbg_nolock(void * pUserData=0x01442248, int nBlockUse=1) Ligne 1231 + 0x17 octets C++
main.exe!_free_dbg(void * pUserData=0x01442248, int nBlockUse=1) Ligne 1194 + 0xd octets C++
main.exe!operator delete(void * p=0x01442248) Ligne 373 + 0xb octets C++
main.exe!operator delete[](void * p=0x01442248) Ligne 387 + 0x9 octets C++
main.exe!DcmElement::~DcmElement() Ligne 171 + 0x12 octets C++
main.exe!DcmOtherByteOtherWord::~DcmOtherByteOtherWord() Ligne 68 + 0x8 octets C++
main.exe!DcmPolymorphOBOW::~DcmPolymorphOBOW() Ligne 59 + 0x8 octets C++
main.exe!DcmPixelData::~DcmPixelData() Ligne 150 + 0x1e octets C++
main.exe!DcmPixelData::`scalar deleting destructor'() + 0xf octets C++
main.exe!DcmItem::~DcmItem() Ligne 174 + 0x20 octets C++
main.exe!DcmDataset::~DcmDataset() Ligne 101 + 0x8 octets C++
main.exe!DcmDataset::`scalar deleting destructor'() + 0xf octets C++
main.exe!DcmSequenceOfItems::~DcmSequenceOfItems() Ligne 105 + 0x20 octets C++
main.exe!DcmFileFormat::~DcmFileFormat() Ligne 114 + 0x8 octets C++
main.exe!DcmFileFormat::`scalar deleting destructor'() + 0xf octets C++
main.exe!CDicomFile::~CDicomFile() Ligne 17 + 0x37 octets C++
I try a solution which consist in not deleting m_pFileformat. It works but I do have memory leaks
Is it a know problem or is there a solution ?
Thx
vince
[/code]