X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c986b01f893e1f457ce94ade0b28d9d7ed890aad..61b98a2dac629cb5dbe1a6834ace6a33ba4eb103:/src/msw/ole/activex.cpp?ds=inline diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index 92a5a1186b..71bbed0450 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -54,7 +54,7 @@ wxDEFINE_EVENT( wxEVT_ACTIVEX, wxActiveXEvent ); {\ public:\ LONG l;\ - TAutoInitInt() : l(0) {}\ + TAutoInitInt() : l(1) {}\ };\ TAutoInitInt refCount, lockCount;\ static void _GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc);\ @@ -1020,14 +1020,25 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) HRESULT hret = cpContainer->FindConnectionPoint(ta->guid, cp.GetRef()); - CHECK_HR(hret); + + // Notice that the return value of CONNECT_E_NOCONNECTION is + // expected if the interface doesn't support connection points. + if ( hret != CONNECT_E_NOCONNECTION ) + { + CHECK_HR(hret); + } if ( cp ) { - IDispatch* disp; - m_frameSite->QueryInterface(IID_IDispatch, (void**)&disp); - hret = cp->Advise(new wxActiveXEvents(this, ta->guid), - &adviseCookie); + wxActiveXEvents * const + events = new wxActiveXEvents(this, ta->guid); + hret = cp->Advise(events, &adviseCookie); + + // We don't need this object any more and cp will keep a + // reference to it if it needs it, i.e. if Advise() + // succeeded. + events->Release(); + CHECK_HR(hret); } }