bug 429642 - cleanup and fix crash in nsAccessibleWrap::get_accKeyboardShortcut() r=surkov

This commit is contained in:
Trevor Saunders 2011-06-28 16:27:03 -07:00
parent c577b30118
commit 50158a9e44

View File

@ -484,18 +484,22 @@ STDMETHODIMP nsAccessibleWrap::get_accKeyboardShortcut(
/* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut)
{
__try {
if (!pszKeyboardShortcut)
return E_INVALIDARG;
*pszKeyboardShortcut = NULL;
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
if (xpAccessible) {
nsAutoString shortcut;
nsresult rv = xpAccessible->GetKeyboardShortcut(shortcut);
if (NS_FAILED(rv))
return E_FAIL;
if (!xpAccessible || xpAccessible->IsDefunct())
return E_FAIL;
*pszKeyboardShortcut = ::SysAllocStringLen(shortcut.get(),
shortcut.Length());
return *pszKeyboardShortcut ? S_OK : E_OUTOFMEMORY;
}
nsAutoString shortcut;
nsresult rv = xpAccessible->GetKeyboardShortcut(shortcut);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*pszKeyboardShortcut = ::SysAllocStringLen(shortcut.get(),
shortcut.Length());
return *pszKeyboardShortcut ? S_OK : E_OUTOFMEMORY;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}