Has anyone had any experience with the ListCtrl SetItemData?
I am populating a list from a database and for each item I'm am calling this function:
LstCtrl->SetItemData(ct, atol(res));
(int) ct is my count keeping track of which index I'm on in the list and res is a string returned from my database.
I'm assuming this Data container is for what ever you want to put in it and not anything in particular right?
when I comment this one line out I don't get the memory leak per list entry.
Is there a place to findout if this is bug? I don't know much about bug reporting. Let me know if anyone would like to see more code.
Thanks
Radez
wxListCtrl::SetItemData Memory Leak
wxListCtrl::SetItemData Memory Leak
VC++ 7.1.3088 on XP Tablet
as of Dec 2004 - wx2.5.3
as of Nov 2004 - wx2.4.2
as of May 2005 - wx2.6.0
as of June 2005 - wx2.6.1
as of Dec 2004 - wx2.5.3
as of Nov 2004 - wx2.4.2
as of May 2005 - wx2.6.0
as of June 2005 - wx2.6.1
-
- Knows some wx things
- Posts: 39
- Joined: Thu Nov 25, 2004 10:10 am
- Location: Germany
The problem seems to be in the wxListCtrl::MSWOnNotify method
It sets the count to zero before the event is sent, and then tries to clean up the user data after, but because the count was already set to zero, wxListCtrl::FreeAllInternalData doesn't free anything.
I moved the m_count = 0 line to be after the call to FreeAllInternalData() that happens in the post-processing of the MSWOnNotify call, and it seems to work better.
In wxWidgets 2.5.3, the change is:
src\msw\listctrl.cpp:
comment out line 1905
add at line 2180:
m_count = 0;
It sets the count to zero before the event is sent, and then tries to clean up the user data after, but because the count was already set to zero, wxListCtrl::FreeAllInternalData doesn't free anything.
I moved the m_count = 0 line to be after the call to FreeAllInternalData() that happens in the post-processing of the MSWOnNotify call, and it seems to work better.
In wxWidgets 2.5.3, the change is:
src\msw\listctrl.cpp:
comment out line 1905
add at line 2180:
m_count = 0;
Create a proper patch and post it on the SF.net Patches tracker
I can assure you we all asked that question... You can find the information here: http://www.wxwidgets.org/technote/patches.htm
- Ryan Norton
- wxWorld Domination!
- Posts: 1319
- Joined: Mon Aug 30, 2004 6:01 pm
Heck, I don't know why I didn't put this in the FAQ soonerAvi wrote:I can assure you we all asked that question... You can find the information here: http://www.wxwidgets.org/technote/patches.htm
[Mostly retired moderator, still check in to clean up some stuff]