summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-11-29 19:17:33 +0100
committerMichael Stahl <mstahl@redhat.com>2013-12-03 20:41:00 +0100
commitba2c68241df89608cdf0fef335a9f158256c7146 (patch)
tree3ce137d10ad5828e98573ab2a1e4d8fc5a0b3f50
parente4747d8149313039d0912f18380b033e3caf9e37 (diff)
winaccessibility: fix my stupid mistake in createAggInstance
Change-Id: I7701021befcf1dbad85557c2095fe4bf0b4e0ff1 (cherry picked from commit d0e8e6e3cd51736583603e37f0ba2ff7bdf29f5c)
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx33
1 files changed, 17 insertions, 16 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index ee86adbd4be7..6c909f9722c1 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -2560,14 +2560,15 @@ BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface**
}
template<typename T> HRESULT
-createAggInstance(CMAccessible &rOuter, REFIID iid, void ** ppvObject)
+createAggInstance(CMAccessible &rOuter, void ** ppvObject)
{
-// return CComCreator< CComAggObject<T> >::CreateInstance(
-// XXX: do not use CComAggObject - the aggregation is hand-crafted!
-// the SmartQI method must not call itself recursively -
-// which it will do if CComAggObject redirects QueryInterface.
- return CComCreator< CComObject<T> >::CreateInstance(
- rOuter.GetControllingUnknown(), iid, ppvObject);
+ // Note: CComAggObject has special handling for IUnknown - must
+ // query for that when creating it! Otherwise we get a T member of it
+ // which will redirect QueryInterface back to CMAccessible infinitely.
+ // (CComAggObject has its own ref-count too which is not a problem
+ // since it is inserted in m_containedObjects.)
+ return CComCreator< CComAggObject<T> >::CreateInstance(
+ rOuter.GetControllingUnknown(), IID_IUnknown, ppvObject);
}
HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject)
@@ -2606,31 +2607,31 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject)
switch (pMap->XIFIndex)
{
case XI_COMPONENT:
- hr = createAggInstance<CAccComponent>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccComponent>(*this, ppvObject);
break;
case XI_TEXT:
- hr = createAggInstance<CAccText>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccText>(*this, ppvObject);
break;
case XI_EDITABLETEXT:
- hr = createAggInstance<CAccEditableText>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccEditableText>(*this, ppvObject);
break;
case XI_IMAGE:
- hr = createAggInstance<CAccImage>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccImage>(*this, ppvObject);
break;
case XI_TABLE:
- hr = createAggInstance<CAccTable>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccTable>(*this, ppvObject);
break;
case XI_ACTION:
- hr = createAggInstance<CAccAction>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccAction>(*this, ppvObject);
break;
case XI_VALUE:
- hr = createAggInstance<CAccValue>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccValue>(*this, ppvObject);
break;
case XI_HYPERTEXT:
- hr = createAggInstance<CAccHypertext>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccHypertext>(*this, ppvObject);
break;
case XI_HYPERLINK:
- hr = createAggInstance<CAccHyperLink>(*this, iid, ppvObject);
+ hr = createAggInstance<CAccHyperLink>(*this, ppvObject);
break;
default:
assert(false);