diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-11-29 19:17:33 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-12-02 13:18:03 +0100 |
commit | d0e8e6e3cd51736583603e37f0ba2ff7bdf29f5c (patch) | |
tree | 5a6cd18d7b214ede2fe512ae9cb895a3838bcda1 /winaccessibility | |
parent | db214684057e3ff2fa32d57c00507309dd6c24d6 (diff) |
winaccessibility: fix my stupid mistake in createAggInstance
Change-Id: I7701021befcf1dbad85557c2095fe4bf0b4e0ff1
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.cxx | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 6e5f01807334..73897c4a469c 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); |