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

ruby-changes:35488

From: suke <ko1@a...>
Date: Sat, 13 Sep 2014 11:28:57 +0900 (JST)
Subject: [ruby-changes:35488] suke:r47570 (trunk): * ext/win32ole/win32ole_event.c(ev_advise, ole_event_free,

suke	2014-09-13 11:28:47 +0900 (Sat, 13 Sep 2014)

  New Revision: 47570

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47570

  Log:
    * ext/win32ole/win32ole_event.c(ev_advise, ole_event_free,
      fev_s_allocate, fev_unadvise): avoid segmentation fault when COM
      server freed before calling Unadvise from WIN32OLE_EVENT object.
    * ext/win32ole/win32ole.c: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c
    trunk/ext/win32ole/win32ole_event.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47569)
+++ ChangeLog	(revision 47570)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Sep 13 11:16:58 2014  Masaki Suketa <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole_event.c(ev_advise, ole_event_free,
+	  fev_s_allocate, fev_unadvise): avoid segmentation fault when COM
+	  server freed before calling Unadvise from WIN32OLE_EVENT object.
+	* ext/win32ole/win32ole.c: ditto.
+
 Sat Sep 13 09:47:44 2014  Eric Wong  <e@8...>
 
 	* man/ruby.1: use https for *.ruby-lang.org links
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 47569)
+++ ext/win32ole/win32ole.c	(revision 47570)
@@ -26,7 +26,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L26
 const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
 #endif
 
-#define WIN32OLE_VERSION "1.8.1"
+#define WIN32OLE_VERSION "1.8.2"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
Index: ext/win32ole/win32ole_event.c
===================================================================
--- ext/win32ole/win32ole_event.c	(revision 47569)
+++ ext/win32ole/win32ole_event.c	(revision 47570)
@@ -58,6 +58,7 @@ typedef struct tagIEVENTSINKOBJ { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L58
 struct oleeventdata {
     DWORD dwCookie;
     IConnectionPoint *pConnectionPoint;
+    IDispatch *pDispatch;
     long event_id;
 };
 
@@ -857,6 +858,7 @@ ole_event_free(struct oleeventdata *pole https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L858
         OLE_RELEASE(poleev->pConnectionPoint);
         poleev->pConnectionPoint = NULL;
     }
+    OLE_RELEASE(poleev->pDispatch);
     free(poleev);
 }
 
@@ -869,6 +871,7 @@ fev_s_allocate(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L871
     poleev->dwCookie = 0;
     poleev->pConnectionPoint = NULL;
     poleev->event_id = 0;
+    poleev->pDispatch = NULL;
     return obj;
 }
 
@@ -946,6 +949,8 @@ ev_advise(int argc, VALUE *argv, VALUE s https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L949
     poleev->dwCookie = dwCookie;
     poleev->pConnectionPoint = pConnectionPoint;
     poleev->event_id = pIEV->m_event_id;
+    poleev->pDispatch = pDispatch;
+    OLE_ADDREF(pDispatch);
 
     return self;
 }
@@ -1147,6 +1152,7 @@ fev_unadvise(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L1152
         OLE_RELEASE(poleev->pConnectionPoint);
         poleev->pConnectionPoint = NULL;
     }
+    OLE_FREE(poleev->pDispatch);
     return Qnil;
 }
 

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

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