<?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 : COM protocol n&#111;n-compliance</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : COM protocol n&#111;n-compliance]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 21 Apr 2026 23:28:02 +0000</pubDate>
  <lastBuildDate>Mon, 26 Sep 2005 23:44:54 +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=1969</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[COM protocol n&#111;n-compliance : Hi,We don&amp;#039;t call InternalAddRef...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=8770&amp;title=com-protocol-noncompliance#8770</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 1969<br /><strong>Posted:</strong> 26 September 2005 at 11:44pm<br /><br /><P><FONT color=#000000>Hi,<BR>We don't call InternalAddRef to allow such code:</FONT></P><P><FONT color=#000000></FONT>&nbsp;</P><P><FONT color=#000000>pCommandBars-&gt;SetImageManager(new CXTPImageManager());</FONT></P><P><FONT color=#000000>if you need to share ImageManager between two controls you must call AddRef manually:</FONT></P><P><FONT color=#000000>CXTPImageManager* pImageManager = pCommandBars-&gt;GetImageManager();</FONT></P><P><FONT color=#000000>pImageManager-&gt;InternalAddRef();</FONT></P><P><FONT color=#000000>m_wndReport.SetImageManager(pImageManager);</FONT></P>]]>
   </description>
   <pubDate>Mon, 26 Sep 2005 23:44:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=8770&amp;title=com-protocol-noncompliance#8770</guid>
  </item> 
  <item>
   <title><![CDATA[COM protocol n&#111;n-compliance : any more information on this topic? I&amp;#039;m...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=8762&amp;title=com-protocol-noncompliance#8762</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1143">umcbrad</a><br /><strong>Subject:</strong> 1969<br /><strong>Posted:</strong> 26 September 2005 at 3:45pm<br /><br /><P>any more information on this topic?</P><P>I'm not 100% sure, but I think that Green is correct...</P>]]>
   </description>
   <pubDate>Mon, 26 Sep 2005 15:45:11 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=8762&amp;title=com-protocol-noncompliance#8762</guid>
  </item> 
  <item>
   <title><![CDATA[COM protocol n&#111;n-compliance : Hi, Sven. I know this. But, for...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5755&amp;title=com-protocol-noncompliance#5755</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=941">Green</a><br /><strong>Subject:</strong> 1969<br /><strong>Posted:</strong> 16 March 2005 at 7:24am<br /><br /><P>Hi, Sven. I know this. But, for example:<BR><BR>1) Parent creates 2 childs and give them the pointer on the same CCmdTarget.<BR>(Reference count will be&nbsp;equal to 1 if we don't call InternalAddRef() for each child). Each child saves pointer for later use.<BR><BR>2) For example one from childs became destroyed. It calls InternalRelease() and CCmdtTarget's reference count&nbsp;became&nbsp;0&nbsp;(look&nbsp;into the MFC it will be deleted!!!)But&nbsp;the second child still alive and it&nbsp;has&nbsp;invalid pointer on the CCmdtTarget. So, any CCmdtTarget's method&nbsp;call will generate JPF.<BR><BR>Correct way:<BR><BR>1) Parent creates 2 childs and give them the pointer on the same CCmdTarget.<BR>Each child saves pointer for later use and call InternalAddRef. (Reference count will be&nbsp;equal to&nbsp;3)<BR><BR>2) If parent don't want to use CCmdTarget by itself it should call InternalRelease. So, the ref count will be equal to 2.<BR><BR>2) For example, one from childs became destroyed. It calls InternalRelease() and CCmdtTarget's reference count&nbsp;became&nbsp;1 (and it will be still alive!!!).&nbsp;Second child can use it safely.<BR><BR></P>]]>
   </description>
   <pubDate>Wed, 16 Mar 2005 07:24:01 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5755&amp;title=com-protocol-noncompliance#5755</guid>
  </item> 
  <item>
   <title><![CDATA[COM protocol n&#111;n-compliance : If you create a CCmdTarget object...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5752&amp;title=com-protocol-noncompliance#5752</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=150">Sven</a><br /><strong>Subject:</strong> 1969<br /><strong>Posted:</strong> 16 March 2005 at 5:56am<br /><br /><P>If you create a CCmdTarget object the internal reference count is always set to 1. CCmdTarget::InternalRelease decrements this reference count and deletes the object if the reference count is zero. </P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 16 Mar 2005 05:56:20 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5752&amp;title=com-protocol-noncompliance#5752</guid>
  </item> 
  <item>
   <title><![CDATA[COM protocol n&#111;n-compliance : Hello I use Xtreme Toolkit Pro...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5745&amp;title=com-protocol-noncompliance#5745</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=941">Green</a><br /><strong>Subject:</strong> 1969<br /><strong>Posted:</strong> 15 March 2005 at 12:05pm<br /><br /><P>Hello I use Xtreme Toolkit Pro v9.60. Look at the next functions:<BR><BR>1)<BR>void CXTPCommandBar::SetImageManager(CXTPImageManager* pImageManager)<BR>{<BR><FONT color=#cc0000>&nbsp;&nbsp;&nbsp; // You call InternalRelease() but there is InternalAddRef() call?</FONT><BR>&nbsp;&nbsp;&nbsp; if (m_pImageManager)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pImageManager-&gt;InternalRelease();</P><P>&nbsp;&nbsp;&nbsp; m_pImageManager = pImageManager;<BR>}<BR><BR>CXTPCommandBar::~CXTPCommandBar()<BR>{<BR>&nbsp;&nbsp;&nbsp; ....................<BR>&nbsp;&nbsp;&nbsp; if (m_pImageManager)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pImageManager-&gt;InternalRelease();<BR>&nbsp;&nbsp;&nbsp; ....................<BR>}<BR><BR>2) And the same notes for CXTPCommandBars implementation:&nbsp;<BR><BR>CXTPCommandBars::~CXTPCommandBars()<BR>{<BR>&nbsp;&nbsp;&nbsp; ....................<BR><FONT color=#cc0000>&nbsp;&nbsp;&nbsp; // You call InternalRelease() but there is InternalAddRef() call?</FONT><BR>&nbsp;&nbsp;&nbsp; if (m_pImageManager)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pImageManager-&gt;InternalRelease();<BR>&nbsp;&nbsp;&nbsp; ....................<BR>}<BR><BR>void CXTPCommandBars::SetImageManager(CXTPImageManager* pImageManager)<BR>{<BR>&nbsp;ASSERT(m_pImageManager == NULL);<BR>&nbsp;m_pImageManager = pImageManager;<BR>}<BR><BR>May be you&nbsp;rely what nobody use it anywhere else.&nbsp;But&nbsp;this is incorrect. Client should not call AddRef() as well. Because it&nbsp;can't know what you want to do with transmitted pointer (use it once&nbsp;for initialization&nbsp;or save it inside for later use).<BR><BR>Lets open any COM book. According to protocol, methods recipient interface pointer as a parameter should call AddRef and Release within their body.&nbsp;<BR>Otherwise you will have unpredictable behaviour for some cases. </P>]]>
   </description>
   <pubDate>Tue, 15 Mar 2005 12:05:18 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1969&amp;PID=5745&amp;title=com-protocol-noncompliance#5745</guid>
  </item> 
 </channel>
</rss>