summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 12:35:15 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 12:35:15 +0000
commit1889a5b274377f48d496c35e88b9b915ccdfe633 (patch)
tree3bae38c742206cb2cdce884b2f371536b6c2d430
parentf29dae3541b771d1593d7da1f26f52a08a349e08 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/win32ole/win32ole.c18
2 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c3567d9c86..5471bbe2d28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Jul 30 21:29:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * 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@atdot.net>
* gc.c: remove unused macros.
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 7f1a7a5cff5..688bee58704 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#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 int beg, unsigned int end)
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 self, USHORT wFlags, BOOL is_bracket)
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 self, USHORT wFlags, BOOL is_bracket)
}
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 self, USHORT wFlags, BOOL is_bracket)
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, IRecordInfo *pri, void *prec)
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)) {