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

ruby-changes:1838

From: ko1@a...
Date: 1 Sep 2007 20:12:11 +0900
Subject: [ruby-changes:1838] suke - Ruby:r13329 (trunk): * ext/win32ole/win32ole.c (ole_event_free): IConnectionPoint should be

suke	2007-09-01 20:11:51 +0900 (Sat, 01 Sep 2007)

  New Revision: 13329

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

  Log:
    * ext/win32ole/win32ole.c (ole_event_free): IConnectionPoint should be
      released.
    
    * ext/win32ole/win32ole.c (EVENTSINK_Destructor): ITypeInfo should be
      released.
    
    * ext/win32ole/win32ole.c (fev_initialize): refactoring.


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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13328)
+++ ChangeLog	(revision 13329)
@@ -1,3 +1,13 @@
+Sat Sep  1 19:59:43 2007  Masaki Suketa  <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c (ole_event_free): IConnectionPoint should be
+	  released.
+
+	* ext/win32ole/win32ole.c (EVENTSINK_Destructor): ITypeInfo should be
+	  released.
+
+	* ext/win32ole/win32ole.c (fev_initialize): refactoring.
+
 Sat Sep  1 16:26:09 2007  NAKAMURA Usaku  <usa@r...>
 
 	* test/socket/test_tcp.rb (test_recvfrom): same as mswin32 on mswin64.
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 13328)
+++ ext/win32ole/win32ole.c	(revision 13329)
@@ -116,7 +116,7 @@
 
 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
 
-#define WIN32OLE_VERSION "1.0.7"
+#define WIN32OLE_VERSION "1.0.8"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -170,8 +170,6 @@
     DWORD m_cRef;
     IID m_iid;
     int m_event_id;
-    DWORD m_dwCookie;
-    IConnectionPoint *pConnectionPoint;
     ITypeInfo *pTypeInfo;
 }IEVENTSINKOBJ, *PIEVENTSINKOBJ;
 
@@ -229,7 +227,8 @@
 };
 
 struct oleeventdata {
-    int freed;
+    DWORD dwCookie;
+    IConnectionPoint *pConnectionPoint;
 };
 
 struct oleparam {
@@ -488,6 +487,7 @@
 static HRESULT find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo);
 static void ole_event_free(struct oleeventdata *poleev);
 static VALUE fev_s_allocate(VALUE klass);
+static VALUE ev_advise(int argc, VALUE *argv, VALUE self);
 static VALUE fev_initialize(int argc, VALUE *argv, VALUE self);
 static VALUE fev_s_msg_loop(VALUE klass);
 static void add_event_call_back(VALUE obj, VALUE event, VALUE data);
@@ -7138,8 +7138,6 @@
     pEv->lpVtbl = &vtEventSink;
     pEv->m_cRef = 0;
     pEv->m_event_id = 0;
-    pEv->m_dwCookie = 0;
-    pEv->pConnectionPoint = NULL;
     pEv->pTypeInfo = NULL;
     return pEv;
 }
@@ -7148,6 +7146,7 @@
     PIEVENTSINKOBJ pEVObj
     ) {
     if(pEVObj != NULL) {
+        OLE_RELEASE(pEVObj->pTypeInfo);
         free(pEVObj);
         pEVObj = NULL;
     }
@@ -7359,8 +7358,7 @@
 static void
 ole_event_free(struct oleeventdata *poleev)
 {
-    ITypeInfo *pti = NULL;
-    IConnectionPoint *pcp = NULL;
+    OLE_FREE(poleev->pConnectionPoint);
     free(poleev);
 }
 
@@ -7370,25 +7368,15 @@
     VALUE obj;
     struct oleeventdata *poleev;
     obj = Data_Make_Struct(klass,struct oleeventdata,0,ole_event_free,poleev);
-/*
-    poleev->pEvent = NULL;
-*/
+    poleev->dwCookie = 0;
+    poleev->pConnectionPoint = NULL;
     return obj;
 }
 
-/*
- *  call-seq:
- *     WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
- *
- *  Returns OLE event object.
- *  The first argument specifies WIN32OLE object.
- *  The second argument specifies OLE event name.
- *     ie = WIN32OLE.new('InternetExplorer.Application')
- *     ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
- */     
 static VALUE
-fev_initialize(int argc, VALUE *argv, VALUE self)
+ev_advise(int argc, VALUE *argv, VALUE self)
 {
+
     VALUE ole, itf;
     struct oledata *pole;
     char *pitf;
@@ -7457,14 +7445,29 @@
     Data_Get_Struct(self, struct oleeventdata, poleev);
     pIEV->m_event_id
         = NUM2INT(rb_funcall(ary_ole_event, rb_intern("length"), 0));
-    pIEV->pConnectionPoint = pConnectionPoint;
     pIEV->pTypeInfo = pTypeInfo;
-    pIEV->m_dwCookie = dwCookie;
+    poleev->dwCookie = dwCookie;
+    poleev->pConnectionPoint = pConnectionPoint;
 
+    return self;
+}
+
+/*
+ *  call-seq:
+ *     WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
+ *
+ *  Returns OLE event object.
+ *  The first argument specifies WIN32OLE object.
+ *  The second argument specifies OLE event name.
+ *     ie = WIN32OLE.new('InternetExplorer.Application')
+ *     ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
+ */     
+static VALUE
+fev_initialize(int argc, VALUE *argv, VALUE self)
+{
+    ev_advise(argc, argv, self);
     rb_ary_push(ary_ole_event, self);
-
-    events = rb_ary_new();
-    rb_ivar_set(self, id_events, events);
+    rb_ivar_set(self, id_events, rb_ary_new());
     return self;
 }
 

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

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