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

ruby-changes:34918

From: suke <ko1@a...>
Date: Wed, 30 Jul 2014 21:35:25 +0900 (JST)
Subject: [ruby-changes:34918] suke:r47001 (trunk): * ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant

suke	2014-07-30 21:35:15 +0900 (Wed, 30 Jul 2014)

  New Revision: 47001

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

  Log:
    * ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant
      by reference when invoke OLE methods at first.
    
    * ext/win32ole/win32ole.c (olerecord_set_ivar): release
      IRecordInfo interface before setting another IRecordInfo interface.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47000)
+++ ChangeLog	(revision 47001)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul 30 21:29:39 2014  Masaki Suketa <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant
+	  by reference when invoke OLE methods at first.
+
+	* ext/win32ole/win32ole.c (olerecord_set_ivar): release
+	  IRecordInfo interface before setting another IRecordInfo interface.
+
 Wed Jul 30 13:17:35 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c: remove unused macros.
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 47000)
+++ ext/win32ole/win32ole.c	(revision 47001)
@@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L143
 
 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
 
-#define WIN32OLE_VERSION "1.6.6"
+#define WIN32OLE_VERSION "1.6.7"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -3460,7 +3460,9 @@ set_argv(VARIANTARG* realargs, unsigned https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3460
     rb_ary_clear(argv);
     while (end-- > beg) {
         rb_ary_push(argv, ole_variant2val(&realargs[end]));
-        VariantClear(&realargs[end]);
+        if (V_VT(&realargs[end]) != VT_RECORD) {
+            VariantClear(&realargs[end]);
+        }
     }
     return argv;
 }
@@ -3585,8 +3587,6 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3587
             if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
                 Data_Get_Struct(param, struct olevariantdata, pvar);
                 VariantCopy(&op.dp.rgvarg[n], &(pvar->var));
-            } else if (rb_obj_is_kind_of(param, cWIN32OLE_RECORD)) {
-                ole_rec2variant(param, &op.dp.rgvarg[n]);
             } else {
                 ole_val2variant(param, &realargs[n]);
                 V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
@@ -3642,7 +3642,9 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3642
             }
             for(i = cNamedArgs; i < op.dp.cArgs; i++) {
                 n = op.dp.cArgs - i + cNamedArgs - 1;
-                VariantClear(&op.dp.rgvarg[n]);
+                if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
+                    VariantClear(&op.dp.rgvarg[n]);
+                }
             }
         }
 
@@ -3678,6 +3680,9 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3680
             param = rb_ary_entry(paramS, i-cNamedArgs);
             if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
                 ole_val2variant(param, &realargs[n]);
+            } else if ( rb_obj_is_kind_of(param, cWIN32OLE_RECORD) &&
+                        V_VT(&realargs[n]) == VT_RECORD ) {
+                olerecord_set_ivar(param, V_RECORDINFO(&realargs[n]), V_RECORD(&realargs[n]));
             }
         }
         set_argv(realargs, cNamedArgs, op.dp.cArgs);
@@ -9286,8 +9291,9 @@ olerecord_set_ivar(VALUE obj, IRecordInf https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9291
     struct olerecorddata *pvar;
 
     Data_Get_Struct(obj, struct olerecorddata, pvar);
+    OLE_ADDREF(pri);
+    OLE_RELEASE(pvar->pri);
     pvar->pri = pri;
-    OLE_ADDREF(pvar->pri);
 
     hr = pri->lpVtbl->GetName(pri, &bstr);
     if (SUCCEEDED(hr)) {

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

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