Click to See Complete Forum and Search --> : Memory leaks


Stijn Steutel
April 19th, 1999, 07:00 AM
Hi,

I'm sorting a ListCtrl. I'm setting Item Data for the CALLBACK compare function like this:

CItemInfo *pItemInfo = new CItemInfo();
pItemInfo->SetLabel(strLabel);
m_ctlList.SetItemData(index, (LPARAM)pItemInfo);



This is working fine, but the debugger detects memory leaks when quitting the app. I think the pointers should be deleted, but I don't know how. When they are in scope, I can't delete them because the CALLBACK needs them. Is it possible to delete them when exiting? Or is there something else I should do?

Any help is appreciated,

Stijn

Franky Braem
April 19th, 1999, 07:12 AM
Delete them when your parentwindow is closed.

mihai
April 19th, 1999, 07:19 AM
Delete all zone allocated with new in LVN_DELETEALLITEMS
Sincerely, Mihai