[ 1053870 ] jacob-msg 2019 - SafeArray + jni 1.4. Fixed a few problems with safe array manipulation that caused memory leaks. Also applied patch required to build against JMI newer than v1.2

This commit is contained in:
schmidlinf
2005-02-03 10:27:39 +00:00
parent e1c0b7680f
commit ebb1eddb69
4 changed files with 21 additions and 5 deletions

View File

@@ -98,13 +98,18 @@ SAFEARRAY *copySA(SAFEARRAY *psa)
SafeArrayGetVartype(psa, &vt);
VARIANT v1, v2;
VariantClear(&v1);
VariantClear(&v2);
VariantInit(&v1);
VariantInit(&v2);
V_VT(&v1) = VT_ARRAY | vt;
V_ARRAY(&v1) = psa;
VariantCopy(&v2, &v1);
SAFEARRAY *sa = V_ARRAY(&v2);
VariantInit(&v2); // make sure it's not owned by this variant
VariantClear(&v2);
VariantInit(&v1);
VariantClear(&v1);
return sa;
}