<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : CXTCheckListBox::SetCheck memory leak</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : CXTCheckListBox::SetCheck memory leak]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 11 Jun 2026 11:16:51 +0000</pubDate>
  <lastBuildDate>Thu, 08 Dec 2005 12:18:22 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=3314</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : Thanks. It worked out pretty well.Not...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=10113&amp;title=cxtchecklistboxsetcheck-memory-leak#10113</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 08 December 2005 at 12:18pm<br /><br /><P>Thanks.&nbsp; It worked out pretty well.&nbsp;&nbsp;Not having the deleted item&nbsp;resulted in an n squared search, but I'm pretty sure that n will remain small so I should be OK.</P><P>--Craig</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 08 Dec 2005 12:18:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=10113&amp;title=cxtchecklistboxsetcheck-memory-leak#10113</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : Hi, CXTEditListBox seds LBN_XT_DELETEITEM...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9987&amp;title=cxtchecklistboxsetcheck-memory-leak#9987</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 03 December 2005 at 4:19am<br /><br /><P>Hi,</P><P>CXTEditListBox seds LBN_XT_DELETEITEM after item deleted using Delete Button, catch it instead:</P><P>ON_LBN_XT_DELETEITEM(IDC_EDIT_LIST, OnDeleteItem)<BR><BR>void CEditListPage1::OnDeleteItem()<BR>{<BR>&nbsp;OnSelchangeEditList();<BR>}<BR></P><P>but unfortunally it doesn't send which item was deleted :(... So you must check all items and find deleted one.</P>]]>
   </description>
   <pubDate>Sat, 03 Dec 2005 04:19:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9987&amp;title=cxtchecklistboxsetcheck-memory-leak#9987</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : The Assert was happening because...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9979&amp;title=cxtchecklistboxsetcheck-memory-leak#9979</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 02 December 2005 at 4:37pm<br /><br /><P>The Assert was happening because the listbox had OwnerDraw&nbsp;set to No instead of Variable and HasStrings was set to False instead of True.</P><P>Hurray!&nbsp; I figured out why it is breaking, but I'm not sure how to fix it.&nbsp; I had put a break point in PreDeleteItem yesterday (at 11:30 pm :-( ) and it was never stopping there.&nbsp; With your post above, I took another look.</P><P>In my dialog box, I have several controls but the two that are involved in this scenario are the CXTCheckListBox and a CXTEditListBox w/ a toolbar.</P><P>When an item in&nbsp;the CXTCheckListBox&nbsp;is "checked" it is added to the CXTEditListBox.&nbsp; When an item in the CXTEditListBox is "deleted" it is unchecked in the CXTCheckListBox .&nbsp; In order to accomplish this, I captured the WM_DELETE event in my dialog.&nbsp; This is having two bad side-effects:</P><P>1.&nbsp; It was grabbing the Delete message that the CXTCheckListBox needs, and consequently caused the memory leak.</P><P>2.&nbsp; WM_DELETE is generated not just when an item in the CXTEditListBox is deleted, but also when it is moved up, moved down, or the text is edited.&nbsp; My capturing of this event was corrupting those actions as well.</P><P>How can I capture when an item is deleted from a CXTEditListBox via the Red X on the toolbar without corrupting everything else?</P><P>Thanks!<BR>-Craig</P><FONT color=#008000 size=2><P>afx_msg void CFileImportDlg::OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)</P><P>{ </P><P>if (lpDeleteItemStruct-&gt;CtlID == IDC_IMPORT_DST_ATTRIBUTES)</P><P>{</P><P>int srcIndex = lpDeleteItemStruct-&gt;itemData;</P><P>m_srcAttributes.SetCheck(srcIndex,FALSE);</P><P>}</P><P>}</P></FONT><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Fri, 02 Dec 2005 16:37:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9979&amp;title=cxtchecklistboxsetcheck-memory-leak#9979</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : Hi, Strange, I don&amp;#039;t see...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9960&amp;title=cxtchecklistboxsetcheck-memory-leak#9960</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 02 December 2005 at 12:49am<br /><br /><P>Hi,</P><P>Strange, I don't see ASSERT in Visual Studio 2003 too... May be you need to recompile library or smth...</P><P>Hint to find problem in your sample: try to set brakpoint in</P><FONT color=#0000ff size=2><P>void</FONT><FONT size=2> CXTCheckListBox::PreDeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct)</FONT></P><P><FONT size=2>and check if it called.</P></FONT>]]>
   </description>
   <pubDate>Fri, 02 Dec 2005 00:49:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9960&amp;title=cxtchecklistboxsetcheck-memory-leak#9960</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : I build a demo app myself, and...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9956&amp;title=cxtchecklistboxsetcheck-memory-leak#9956</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 01 December 2005 at 6:00pm<br /><br /><P>I build a demo app myself, and cannot reproduce the leak.&nbsp; I've compared my project to the sample project looking for anything that might cause memory to be handled differently between the two projects and cannot find anything.&nbsp; Yet...</P><P>In my project I am definately seeing a memory leak.&nbsp; Line 160 in xtchecklistbox.cpp is where the leak is being allocated:</P><FONT color=#0000ff><FONT color=#0000ff><P><FONT size=2>if</FONT></FONT><FONT color=#000000 size=2> (pState == NULL)</FONT></P><P><FONT size=2>pState = <FONT color=#0000ff>new</FONT> CHECK_DATA;</FONT></P><P><FONT color=#000000 size=2>Do you have any ideas at all as to why this widget would be leaking memory in my dialog, and not leak it elsewhere?&nbsp; Its just a regular old CDialog.&nbsp; I've been poring through code for 2 days, and just cannot determine what might be causing this.&nbsp; </FONT></P><P><FONT color=#000000 size=2>The only other area I have trouble is in an external lib that is built with&nbsp;/MD.&nbsp; I can't use new/delete to create objects in that DLL, but I don't see how that would relate to this at all.</FONT></P><P><FONT color=#000000 size=2>--Craig</FONT></P><P><FONT size=2></FONT>&nbsp;</P></FONT><P><FONT size=2>&nbsp;</P></FONT>]]>
   </description>
   <pubDate>Thu, 01 Dec 2005 18:00:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9956&amp;title=cxtchecklistboxsetcheck-memory-leak#9956</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : The code you provided fails on...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9951&amp;title=cxtchecklistboxsetcheck-memory-leak#9951</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 01 December 2005 at 1:40pm<br /><br /><P>The code you provided fails on ASSERT on line 226 in XTCheckListBox.cpp when it is compiled and run under Visual Studio .NET 2003 and Windows XP SP2.</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 01 Dec 2005 13:40:36 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9951&amp;title=cxtchecklistboxsetcheck-memory-leak#9951</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : I&amp;#039;ll add my memory checker...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9950&amp;title=cxtchecklistboxsetcheck-memory-leak#9950</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 01 December 2005 at 11:00am<br /><br /><P>I'll add my memory checker to your code and check it again.</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 01 Dec 2005 11:00:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9950&amp;title=cxtchecklistboxsetcheck-memory-leak#9950</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : Can&amp;#039;t reproduce it: 2005...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9929&amp;title=cxtchecklistboxsetcheck-memory-leak#9929</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 01 December 2005 at 5:07am<br /><br /><P>Can't reproduce it:</P><P><A href="http://forum.codejock.com/uploads/oleg/2005-12-01_050723_CheckListBoxSample.zip" target="_blank">2005-12-01_050723_CheckListBoxSample.zip</A></P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 01 Dec 2005 05:07:51 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9929&amp;title=cxtchecklistboxsetcheck-memory-leak#9929</guid>
  </item> 
  <item>
   <title><![CDATA[CXTCheckListBox::SetCheck memory leak : When I call CXTCheckListBox::SetCheck...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9918&amp;title=cxtchecklistboxsetcheck-memory-leak#9918</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1391">craig</a><br /><strong>Subject:</strong> 3314<br /><strong>Posted:</strong> 30 November 2005 at 3:42pm<br /><br /><P>When I call CXTCheckListBox::SetCheck in my dialog, it causes a memory leak.&nbsp; Is there a workaround for this?</P><P>&nbsp;</P><P>CXTChecklistbox m_checklistBox;&nbsp; // in header file</P><P>m_checklistBox.Initialize();&nbsp; // In OnInitInstance</P><P>int index = m_checklistBox.AddString("test")&nbsp; // In OnInitInstance or elsewhere</P><P>m_checklistBox.SetCheck(index, TRUE);&nbsp; // In OnInitInstance or elsewhere</P><P>Cancel out of the dialog, exit the application, and if you have a mem leak detector running the mem leak will appear.&nbsp;&nbsp; I've done extensive testing and this method is definately where the leak is.&nbsp; Here is the output from mine:</P><FONT size=1><P>Detected memory leaks!</P><P>Dumping objects -&gt;</P><P>c:\program files\codejock software\mfc\xtreme toolkitpro v9.80\source\controls\xtchecklistbox.cpp(161) : {4449} normal block at 0x0198F290, 12 bytes long.</P><P>Data: &lt; &gt; 00 00 00 00 01 00 00 00 00 00 00 00 </P><P>Object dump complete.</P></FONT><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 30 Nov 2005 15:42:21 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3314&amp;PID=9918&amp;title=cxtchecklistboxsetcheck-memory-leak#9918</guid>
  </item> 
 </channel>
</rss>