From: Vadim Zeitlin Date: Sun, 24 Oct 2010 22:41:36 +0000 (+0000) Subject: Fix problems with reference counting in wxActiveXContainer. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e0b5dc3d63521f09691b14c1665370d85ef042ea Fix problems with reference counting in wxActiveXContainer. Ensure that the IFrameSite object is created with valid (i.e. non-zero) reference count by calling AddRef() on it immediately after creation and remove the weird QueryInterface() call which was used to work around this bug. Closes #11566. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index e2661bda65..743689bbb0 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -928,6 +928,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) // FrameSite m_frameSite = new FrameSite(m_realparent, this); + m_frameSite->AddRef(); // oleClientSite hret = m_clientSite.QueryInterface( IID_IOleClientSite, (IDispatch *) m_frameSite); @@ -1030,8 +1031,6 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) if ( cp ) { - IDispatch* disp; - m_frameSite->QueryInterface(IID_IDispatch, (void**)&disp); hret = cp->Advise(new wxActiveXEvents(this, ta->guid), &adviseCookie); CHECK_HR(hret);