]> git.sesse.net Git - vlc/blobdiff - activex/connectioncontainer.cpp
src/control: a bit of cleanup here and there
[vlc] / activex / connectioncontainer.cpp
index bc63ee4e1f12f3f405896b19100e8f29aad64da0..40ed87751322d5df31d40b530618cc8f1a6f4a09 100644 (file)
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "plugin.h"
@@ -101,7 +101,7 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
 
     pUnk->AddRef();
     cd.pUnk = pUnk;
-    *pdwCookie = cd.dwCookie = _connections.size();
+    *pdwCookie = cd.dwCookie = _connections.size()+1;
 
     _connections.push_back(cd);
 
@@ -110,9 +110,9 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
 
 STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
 {
-    if( pdwCookie < _connections.size() )
+    if( (0 < pdwCookie) && (pdwCookie <= _connections.size()) )
     {
-        CONNECTDATA cd = _connections[pdwCookie];
+        CONNECTDATA cd = _connections[pdwCookie-1];
         if( NULL != cd.pUnk )
         {
             cd.pUnk->Release();