[前][次][番号順一覧][スレッド一覧]

ruby-changes:1781

From: ko1@a...
Date: 25 Aug 2007 23:01:22 +0900
Subject: [ruby-changes:1781] suke - Ruby:r13272 (trunk): * ext/win32ole/win32ole.c (ole_event_free, EVENTSINK_Destructor,

suke	2007-08-25 23:01:08 +0900 (Sat, 25 Aug 2007)

  New Revision: 13272

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c

  Log:
    * ext/win32ole/win32ole.c (ole_event_free, EVENTSINK_Destructor,
      fev_initialize): remove the connection ole_event_free and 
      EVENTSINK_Destructor.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13272&r2=13271
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/win32ole/win32ole.c?r1=13272&r2=13271

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13271)
+++ ChangeLog	(revision 13272)
@@ -1,3 +1,9 @@
+Sat Aug 25 22:50:14 2007  Masaki Suketa  <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c (ole_event_free, EVENTSINK_Destructor,
+	  fev_initialize): remove the connection ole_event_free and 
+	  EVENTSINK_Destructor.
+
 Sat Aug 25 17:52:06 2007  Koichi Sasada  <ko1@a...>
 
 	* string.c, include/ruby/intern.h: export rb_str_length().
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 13271)
+++ ext/win32ole/win32ole.c	(revision 13272)
@@ -116,7 +116,7 @@
 
 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
 
-#define WIN32OLE_VERSION "1.0.3"
+#define WIN32OLE_VERSION "1.0.4"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -173,7 +173,6 @@
     DWORD m_dwCookie;
     IConnectionPoint *pConnectionPoint;
     ITypeInfo *pTypeInfo;
-    int *ptr_freed;
 }IEVENTSINKOBJ, *PIEVENTSINKOBJ;
 
 VALUE cWIN32OLE;
@@ -230,7 +229,6 @@
 };
 
 struct oleeventdata {
-    IEVENTSINKOBJ *pEvent;
     int freed;
 };
 
@@ -7139,7 +7137,6 @@
     pEv->m_dwCookie = 0;
     pEv->pConnectionPoint = NULL;
     pEv->pTypeInfo = NULL;
-    pEv->ptr_freed = NULL;
     return pEv;
 }
 
@@ -7147,7 +7144,6 @@
     PIEVENTSINKOBJ pEVObj
     ) {
     if(pEVObj != NULL) {
-        *(pEVObj->ptr_freed) = 1;
         free(pEVObj);
         pEVObj = NULL;
     }
@@ -7361,25 +7357,7 @@
 {
     ITypeInfo *pti = NULL;
     IConnectionPoint *pcp = NULL;
-
-    if (poleev->freed == 1) {
-        /* 
-         * this return create memory leak.
-         * but poleev->pEvent->pConnectionPoint shoul'd not be freed
-         * until poleev->freed == 0.
-         */
-        return; 
-    }
-    if(poleev->pEvent) {
-        pti = poleev->pEvent->pTypeInfo;
-        if(pti) OLE_RELEASE(pti);
-        pcp = poleev->pEvent->pConnectionPoint;
-        if(pcp) {
-            pcp->lpVtbl->Unadvise(pcp, poleev->pEvent->m_dwCookie);
-            OLE_RELEASE(pcp);
-        }
-        free(poleev);
-    }
+    free(poleev);
 }
 
 static VALUE
@@ -7388,7 +7366,9 @@
     VALUE obj;
     struct oleeventdata *poleev;
     obj = Data_Make_Struct(klass,struct oleeventdata,0,ole_event_free,poleev);
+/*
     poleev->pEvent = NULL;
+*/
     return obj;
 }
 
@@ -7471,14 +7451,12 @@
     }
 
     Data_Get_Struct(self, struct oleeventdata, poleev);
-    poleev->pEvent = pIEV;
-    poleev->pEvent->m_event_id
+    pIEV->m_event_id
         = NUM2INT(rb_funcall(ary_ole_event, rb_intern("length"), 0));
-    poleev->pEvent->pConnectionPoint = pConnectionPoint;
-    poleev->pEvent->pTypeInfo = pTypeInfo;
-    poleev->pEvent->m_dwCookie = dwCookie;
-    poleev->freed = 0;
-    poleev->pEvent->ptr_freed = &(poleev->freed);
+    pIEV->pConnectionPoint = pConnectionPoint;
+    pIEV->pTypeInfo = pTypeInfo;
+    pIEV->m_dwCookie = dwCookie;
+
     rb_ary_push(ary_ole_event, self);
 
     events = rb_ary_new();

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]