]> git.sesse.net Git - vlc/blobdiff - activex/connectioncontainer.cpp
input/meta.c: Don't re-run the art finder if the art was previously set in input_ArtF...
[vlc] / activex / connectioncontainer.cpp
index 36e8eba8053319b9211c222888dcb1d864dfe874..757f5139154175b1e8f0a5f08479c3060c248bb8 100644 (file)
@@ -35,7 +35,9 @@ struct VLCEnumConnectionsDereference
     CONNECTDATA operator()(const map<DWORD,LPUNKNOWN>::iterator& i)
     {
         CONNECTDATA cd;
-        
+
+        i->second->AddRef();
+
         cd.dwCookie = i->first;
         cd.pUnk     = i->second;
         return cd;
@@ -115,12 +117,13 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
     if( (NULL == pUnk) || (NULL == pdwCookie) )
         return E_POINTER;
 
-    pUnk->AddRef();
-
-    *pdwCookie = ++dwCookieCounter;
-    _connections[*pdwCookie] = pUnk;
-
-    return S_OK;
+    if( SUCCEEDED(pUnk->QueryInterface(_iid, (LPVOID *)&pUnk)) )
+    {
+        *pdwCookie = ++dwCookieCounter;
+        _connections[*pdwCookie] = pUnk;
+        return S_OK;
+    }
+    return CONNECT_E_CANNOTCONNECT;
 };
 
 STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
@@ -157,7 +160,7 @@ void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS *pDispParams)
         if( NULL != pUnk )
         {
             IDispatch *pDisp;
-            if( SUCCEEDED(pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
+            if( SUCCEEDED(pUnk->QueryInterface(_iid, (LPVOID *)&pDisp)) )
             {
                 pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
                 pDisp->Release();