]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix problems with reference counting in wxActiveXContainer.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 24 Oct 2010 22:41:36 +0000 (22:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 24 Oct 2010 22:41:36 +0000 (22:41 +0000)
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

src/msw/ole/activex.cpp

index e2661bda65fe5dc78ad38ee0ec78a6afc417c133..743689bbb07e146e4110ce4a2dee1a6155785b77 100644 (file)
@@ -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);