How can I delete those objects. because I see memory leak if I don't delete
them.
Thanks in advance,
Jas
memory leak reports:
"{83} client block at 0x00302E00, subtype 0, 144 bytes long.a
CMultiDocTemplate object at 00302E00, 144 bytes long"
I am using MFC version 6.
Actually ExitInstance in CWinApp calls SaveStdProfileSettings where
ASSERT_VALID(this) get called.
Thanks,
Jas
> Was anything else reported as leaked, besides the doc templates?
No! nothing else has reported as leaked.
> You did call AddDocTemplate in the InitInstance, right?
Yes! I did call AddDocTemplate.
The difference between my application and MFC AppWizard generated
application is that I declared CMultiDocTemplate* object as my application's
MEMBER variable :
m_pMyTemplate = new CMultiDocTemplate(...);
AddDocTemplate(m_pMyTemplate);
I don't know if that is the source of problem. But I need to do that because
I need to have access to this member from somewhere else in my program.
Jas.
Have you identified the standard MFC code that deletes the doc templates? Put a
breakpoint in there, and step through to discover why your object is not getting
deleted properly. If it doesn't hit your breakpoint, then we need to find out
why.
Close the app and debug the destructor CDocManager::~CDocManager() in file
docmgr.cpp.
Count how often the while-loop is performed and count how often you called
AddDocTemplate.
The difference should be zero if pTemplate->m_bAutoDelete is TRUE;.