<?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 : XTPImageManager::AddIcons appears to be buggy.</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : General Discussion : XTPImageManager::AddIcons appears to be buggy.]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 01 May 2026 13:25:13 +0000</pubDate>
  <lastBuildDate>Tue, 05 Sep 2023 04:54:15 +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=24418</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[XTPImageManager::AddIcons appears to be buggy. : Hello,Unfortunately we are unable...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78772&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78772</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9012">agontarenko</a><br /><strong>Subject:</strong> 24418<br /><strong>Posted:</strong> 05 September 2023 at 4:54am<br /><br />Hello,<br><br>Unfortunately we are unable to re-produce the problem. Can you please provide more detailed information and steps to take, screenshots or video can be useful as well. If it cannot be re-produced in any of our sample applications provided I would appreciate you sending a small code snippet or ideally a sample application so that we could debug it.<br><br>Regards,<br>Artem Gontarenko]]>
   </description>
   <pubDate>Tue, 05 Sep 2023 04:54:15 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78772&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78772</guid>
  </item> 
  <item>
   <title><![CDATA[XTPImageManager::AddIcons appears to be buggy. : As a work-around, and possibly...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78770&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78770</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2857">lviolette</a><br /><strong>Subject:</strong> 24418<br /><strong>Posted:</strong> 01 September 2023 at 8:07pm<br /><br />As a work-around, and possibly a more correct way to do this.&nbsp; I updated the code to avoid a temporary CXTPImageManager and it "appears" to be functioning correctly.<div><br></div><div><pre ="BBcode" style="width: 1292.62px; : rgb248, 248, 252;"><div>void CMyXTPResizeDlg::UpdateImages()</div><div>{</div><div>&nbsp; &nbsp; static UINT pnCommands&#091;&#093; =&nbsp;</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ID_WETRACK_AUTOKEY, ID_WETRACK_UPDATEKEY,&nbsp;ID_WETRACK_SCALEMODE</div><div>&nbsp; &nbsp; };</div><div><br></div><div>&nbsp; &nbsp; {</div><div>        CXTPTempColorMask mask(RGB(255, 0, 255));</div><div><span style="white-space: normal;">&nbsp; &nbsp; &nbsp; &nbsp; XTPImageManager().SetIcons(IDPNG_TOOLBAR_WETRACK, pnCommands, 3, CSize(16, 16));</span></div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; // This avoided the local image manager.</div><div>    // From what I've seen so far, the buttons are showing correctly.</div><div>}</div></pre></div><div><br></div>]]>
   </description>
   <pubDate>Fri, 01 Sep 2023 20:07:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78770&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78770</guid>
  </item> 
  <item>
   <title><![CDATA[XTPImageManager::AddIcons appears to be buggy. : Code that worked in 18.3, but...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78769&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78769</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2857">lviolette</a><br /><strong>Subject:</strong> 24418<br /><strong>Posted:</strong> 01 September 2023 at 6:57pm<br /><br />Code that worked in 18.3, but appears to be broken in 22.1.&nbsp; This code is lead-up to a crash I'm having while migrating to 22.1<div><br><div>Consider the following:<div><table width="99%"><tr><td><pre class="BBcode"><br><div>void CMyXTPResizeDlg::UpdateImages()</div><div>{</div><div>&nbsp; &nbsp; static UINT pnCommands&#091;&#093; =&nbsp;</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ID_WETRACK_AUTOKEY, ID_WETRACK_UPDATEKEY,&nbsp;ID_WETRACK_SCALEMODE</div><div>&nbsp; &nbsp; };</div><div><br></div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; CXTPImageManager localImageManager;</div><div><span style="white-space: normal;">&nbsp; &nbsp; &nbsp; &nbsp; localImageManager.SetMaskColor(RGB(255, 0, 255));</span></div><div><span style="white-space: normal;">&nbsp; &nbsp; &nbsp; &nbsp; localImageManager.SetIcons(IDPNG_TOOLBAR_WETRACK, pnCommands, 3, CSize(16, 16));</span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; GetCommandBars()-&gt;GetImageManager()-&gt;AddIcons(&amp;localImageManager);</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; // When the iconsets were copied over, their CXTPImageManager* member was NOT updated.</div><div>&nbsp; &nbsp; // They are still pointing at localImageManager even though are actually in the dialog's image manager.</div><div>&nbsp; &nbsp; // This results in a crash down the line.</div><div>}</div><div></pre></td></tr></table></div></div><div><br></div><div>Attempt to explain why we crash...</div><div><div><table width="99%"><tr><td><pre class="BBcode"></div><div></div></div><div><div>void CXTPImageManager::AddIcons(CXTPImageManager* pImageManager)</div></div><div></pre></td></tr></table></div><div>This function adds icons from one image manager to another.&nbsp; It does so by iterating over</div><div>the icons, retrieving each iconset and passing the iconset to</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>void CXTPImageManager::AddIcons(CXTPImageManagerIconSet* pIconSetAdd)</div></div><div></pre></td></tr></table></div><div><br></div><div>This function then iterates over the various icons in the icons set and adds them to the iconset of the image manager.</div><div>But, it does so by constructing a CXTPImageManagerIcon like so:<br><table width="99%"><tr><td><pre class="BBcode"></div><div><div><span style="white-space: normal;">pIcon = new CXTPImageManagerIcon(pIconSetAdd-&gt;GetID(), pIconSetAdd,</span></div><div><span style="white-space: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CSize(XTPToIntChecked(nWidth), 0));</span></div></div><div></pre></td></tr></table></div><div>That pIconSetAdd is actually (&amp;localImageManager).&nbsp; And it's being used as the image manager in this new icon.&nbsp; Which is invalid.</div><div>This logic has changed since 18.3.</div><div><br></div></div><div>In 22.1, it crashes in CXTPImageManager::SetIcon(const CXTPImageManagerIconHandle&amp; hIcon) because I am updating one of the images and it hits this code:<br><table width="99%"><tr><td><pre class="BBcode"></div><div><div><span style="white-space: normal;">if (m_pIconSet)</span></div><div><span style="white-space: normal;">&nbsp; &nbsp; m_pIconSet-&gt;RefreshAll();</span></div></div><div></pre></td></tr></table></div><div>Since m_pIconSet is pointing to the deleted localImageManager, it crashes.&nbsp; In 18.3 m_pIconSet here would have been nullptr, so it would have skipped calling RefreshAll.</div><div><br></div><div>My question is...</div><div>Is CXTPImageManager::AddIcons(CXTPImageManager* pImageManager) working as intended?</div><div>Is it suppose to take the images in pImageManager, add them to "this", but leave them with pointers to pImageManager rather than "this"?</div><div><br></div><div>I'd like an answer to this before I rewrite this code I inherited to add the icons the to image manager and correctly set the iconset's m_pImageManager pointer.</div><div><br></div></div>]]>
   </description>
   <pubDate>Fri, 01 Sep 2023 18:57:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24418&amp;PID=78769&amp;title=xtpimagemanageraddicons-appears-to-be-buggy#78769</guid>
  </item> 
 </channel>
</rss>