<?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 : Another crash via UIAutomationCore</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Another crash via UIAutomationCore]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 12 May 2026 21:14:30 +0000</pubDate>
  <lastBuildDate>Wed, 22 Jun 2022 11:19:33 +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=24301</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[Another crash via UIAutomationCore : Regarding the AccessibleLocation...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78470&amp;title=another-crash-via-uiautomationcore#78470</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24301<br /><strong>Posted:</strong> 22 June 2022 at 11:19am<br /><br /><div>Regarding the AccessibleLocation code. This crash is once again due to CJ's usage of the code pattern:</div><div><br></div><div>GetX()-&gt;CallMethodUsingNullPtrReturnedFromOperator().</div><div><br></div><div>I found GetItem will return nullptr when the index is invalid as it is in the case that is crashing our app with the text cursor indicator setting on. I am rebuilding the code now with this:</div><div><br></div><div>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; CXTPTabManagerItem* pItem = GetItem(nIndex - 1);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if( pItem )<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rcControl = pItem-&gt;GetRect();<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return E_INVALIDARG;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }</div><div><br></div><div>Using that coding pattern may be convenient but it just isn't solid code, in my opinion. Nor is the use of that pattern consistent. See this which is in the same source file:</div><div><br></div><div>HRESULT CXTPRibbonControlTab::GetAccessibleName(VARIANT varChild, BSTR* pszName)<br>{<br>&nbsp;&nbsp; &nbsp;SAFE_MANAGE_STATE(m_pModuleState);<br><br>&nbsp;&nbsp; &nbsp;int nIndex = GetChildIndex(&amp;varChild);<br><br>&nbsp;&nbsp; &nbsp;if (nIndex == CHILDID_SELF)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return CXTPControl::GetAccessibleName(varChild, pszName);<br><br>&nbsp;&nbsp; &nbsp;CXTPTabManagerItem* pItem = GetItem(nIndex - 1);<br>&nbsp;&nbsp; &nbsp;if (!pItem)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return E_INVALIDARG;<br><br>&nbsp;&nbsp; &nbsp;CString strCaption = pItem-&gt;GetCaption();<br>&nbsp;&nbsp; &nbsp;CXTPDrawHelpers::StripMnemonics(strCaption);<br><br>&nbsp;&nbsp; &nbsp;*pszName = strCaption.AllocSysString();<br>&nbsp;&nbsp; &nbsp;return S_OK;<br>}<br></div><div><br></div><div>Much better as it won't crash if some silly OS code calls that API with an invalid arg. Now that I noticed that, I'm going back to my source change and doing a copy&amp;paste so the two code blocks look the same as well as behaving the same.</div><div><br></div><div>CodeJock, can you make the mods to this source so I don't have to keep updating your code in the future. If you haven't already done so, that is.<br></div>]]>
   </description>
   <pubDate>Wed, 22 Jun 2022 11:19:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78470&amp;title=another-crash-via-uiautomationcore#78470</guid>
  </item> 
  <item>
   <title><![CDATA[Another crash via UIAutomationCore : I was running the RibbonMDISample...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78469&amp;title=another-crash-via-uiautomationcore#78469</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24301<br /><strong>Posted:</strong> 22 June 2022 at 11:08am<br /><br /><div>I was running the RibbonMDISample seeing if I could crash in the same place as our app. What I was doing is using control-n to open a new file and then F4 to close the window. I repeated that a number of times. I crashed but not in the same spot:</div><div><br></div><div>&nbsp;&nbsp;&nbsp;&nbsp; riched20.dll!00007fff7f854962()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; riched20.dll!00007fff7f8806b3()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; riched20.dll!00007fff7f8650b1()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!RichEditProxy::~RichEditProxy(void)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!RichEditProxy::`vector deleting destructor'(unsigned int)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!RefcountBase::Release(void)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!UiaNode::ProviderInfo::~ProviderInfo(void)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!`eh vector destructor iterator'(void *,unsigned __int64,unsigned __int64,void (*)(void *))&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!UiaNode::`vector deleting destructor'(unsigned int)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!UiaNode::Release(void)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!ReleaseOnCorrectContext_Callback()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!ComInvoker::CallTarget()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!ReleaseCollection::DispatchReleases()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!ChannelBasedServerConnection::ReleaseObjects()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!HookBasedServerConnection::`vector deleting destructor'(unsigned int)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!RefcountBase::Release(void)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!HookBasedServerConnectionManager::HookCallback()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!HookUtil&lt;&amp;HookBasedClientConnection::HookCallback(void *,unsigned long,void * *,unsigned long *,void * *),0&gt;::CallOut(void *,unsigned long,void * *,unsigned long *,void * *)&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!HandleSyncHookMessage()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; UIAutomationCore.dll!HookUtil&lt;&amp;HookBasedClientConnection::HookCallback,0&gt;::CallWndProc()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; user32.dll!fnHkINLPCWPSTRUCTW()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; user32.dll!__fnDWORD()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; ntdll.dll!KiUserCallbackDispatcherContinue()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; win32u.dll!NtUserPeekMessage()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; user32.dll!_PeekMessage()&nbsp;&nbsp;&nbsp; Unknown<br>&nbsp;&nbsp;&nbsp;&nbsp; user32.dll!PeekMessageW()&nbsp;&nbsp;&nbsp; Unknown<br>&gt;&nbsp;&nbsp;&nbsp; mfc140ud.dll!CWinThread::Run() Line 617&nbsp;&nbsp;&nbsp; C++<br>&nbsp;&nbsp;&nbsp;&nbsp; mfc140ud.dll!CWinApp::Run() Line 787&nbsp;&nbsp;&nbsp; C++<br>&nbsp;&nbsp;&nbsp;&nbsp; mfc140ud.dll!AfxWinMain(HINSTANCE__ *, HINSTANCE__ *, wchar_t *, int) Line 47&nbsp;&nbsp;&nbsp; C++<br>&nbsp;&nbsp;&nbsp;&nbsp; RibbonMDISample.exe!wWinMain(HINSTANCE__ *, HINSTANCE__ *, wchar_t *, int) Line 26&nbsp;&nbsp;&nbsp; C++<br><br></div>]]>
   </description>
   <pubDate>Wed, 22 Jun 2022 11:08:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78469&amp;title=another-crash-via-uiautomationcore#78469</guid>
  </item> 
  <item>
   <title><![CDATA[Another crash via UIAutomationCore : CJ,Please fix this code. The input...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78466&amp;title=another-crash-via-uiautomationcore#78466</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24301<br /><strong>Posted:</strong> 21 June 2022 at 3:14pm<br /><br /><div>CJ,</div><div><br></div><div>Please fix this code. The input index isn't being tested for validity and you are accessing an item in an array past the array index:</div><div><br></div><div>HRESULT CXTPRibbonControlTab::AccessibleLocation(long* pxLeft, long* pyTop, long* pcxWidth,<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;long* pcyHeight, VARIANT varChild)<br>{<br>&nbsp;&nbsp; &nbsp;*pxLeft = *pyTop = *pcxWidth = *pcyHeight = 0;<br><br>&nbsp;&nbsp; &nbsp;int nIndex = GetChildIndex(&amp;varChild);<br><br>&nbsp;&nbsp; &nbsp;if (!m_pParent-&gt;GetSafeHwnd())<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return S_OK;<br><br>&nbsp;&nbsp; &nbsp;if (!IsVisible())<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return S_OK;<br><br>&nbsp;&nbsp; &nbsp;CRect rcControl = GetRect();<br><br>&nbsp;&nbsp; &nbsp;if (nIndex != CHILDID_SELF)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; rcControl = GetItem(<font color="#FF0066"><b>nIndex - 1</b></font>)-&gt;GetRect();<br>&nbsp;&nbsp; &nbsp;}<br><br>&nbsp;&nbsp; &nbsp;m_pParent-&gt;ClientToScreen(&amp;rcControl);<br><br>&nbsp;&nbsp; &nbsp;*pxLeft&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; = rcControl.left;<br>&nbsp;&nbsp; &nbsp;*pyTop&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; = rcControl.top;<br>&nbsp;&nbsp; &nbsp;*pcxWidth&nbsp; = rcControl.Width();<br>&nbsp;&nbsp; &nbsp;*pcyHeight = rcControl.Height();<br><br>&nbsp;&nbsp; &nbsp;return S_OK;<br>}</div><div><br></div><div>In my case, the array size is 7 and the input is an VT_I4 with value 8. So, 6 is the last valid index. Just return an error instead of crashing the process. In my case, we are MDI and we are rebuilding the command ribbon. This call was made for the ribbon tab control. Unfortunately this UIAutomationCore is calling here when I have the OS Text Cursor Indicator setting on because our customer base is SCREAMING about how unstable we are when it is running.</div><div><br></div><div>Unfortunately this UIAutomationCore code related to this cursor text indicator has its own thread and its own hooking code. I have found no way to shut this down on a per process basis. So, we are left with finding these "random" crashes and do our best to address them. This is random because the OS code is using a thread to try to track what is going on and it is often behind the curve. We have customer videos showing us that if they work too fast, we crash. It can take a number of times to crash but eventually we do.</div><div><br></div><div>What I don't understand right now is from where Microsoft is getting this index they pass in. I am trapping no breakpoints in the get_accChildCount method.<br></div><div><br></div><div>In this case, an easy test of the array size is all that is needed. I'd return E_FALI or some other COM error like E_INVALIDARG.<br></div>]]>
   </description>
   <pubDate>Tue, 21 Jun 2022 15:14:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24301&amp;PID=78466&amp;title=another-crash-via-uiautomationcore#78466</guid>
  </item> 
 </channel>
</rss>