From 165b6b7646c0699c70c9a32be8039daeafa13675 Mon Sep 17 00:00:00 2001 From: clay_shooter Date: Sat, 10 Mar 2007 16:04:39 +0000 Subject: [PATCH] SF 1674179 enum variant leak. also affects 1112667 1465539 1569864 --- build.xml | 4 ++-- docs/ReleaseNotes.html | 18 +++++++++++++++++- jni/EnumVariant.cpp | 4 ++++ jni/Variant.cpp | 4 +++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/build.xml b/build.xml index 8fc5ff5..4518f73 100644 --- a/build.xml +++ b/build.xml @@ -19,7 +19,7 @@ The file for MS Visual C++ 6.0 building only the 32 bit version (the only version available through 1.11) looks something like: - JDK=d:/j2sdk1.4.2_09 + JDK=d:/j2sdk1.4.2_13 MSDEVDIR=d:\\apps\\Microsoft Visual Studio\\VC98 version=1.11-pre2 @@ -27,7 +27,7 @@ compilation_tools.properties in this situation should look something like: - JDK=d:/j2sdk1.4.2_09 + JDK=d:/j2sdk1.4.2_13 MSDEVDIR=d:\\apps\\Microsoft Visual Studio\\VC98 MSSDKDIR=D:\\Apps\\Microsoft Platform SDK for Windows Server 2003 R2 version=1.11-pre2 diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index b2bf6b5..3dfdb9e 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -21,11 +21,23 @@ 1651926 ActiveXComponent: getPropertyAsString should call getString() instead of toString() + + 1569864 + IEnumVariant leak fixed in patch 1674179 + + + 1112667 + IEnumVariant leak fixed in patch 1674179 + + + 1465539 + IEnumVariant leak fixed in patch 1674179 + 1504120 Microsoft 2003 Server crashes. Server crashes on MS 2003 Server have been reported over time. Some users have had say that Jacob must be built on MS2003 Server to run reliably. - The Jacob distribution on Sourceforge is built on Windows XP SP2 (this item is soley informationional) + The Jacob distribution on Sourceforge is built on Windows XP SP2 (No code change. Just a documentation updat)   @@ -40,6 +52,10 @@ in hashmap. This causes objects to be garbage finalized when they shouldn't be resulting in vm failures with large (large) numbers of objects. + + 1674179 + Fixed Enum leaks with EnumVariants in Variant.cpp and EnumVariant.cpp +     diff --git a/jni/EnumVariant.cpp b/jni/EnumVariant.cpp index ee84d6f..25fb226 100644 --- a/jni/EnumVariant.cpp +++ b/jni/EnumVariant.cpp @@ -81,6 +81,10 @@ Java_com_jacob_com_EnumVariant_Next(JNIEnv* env, jobject _this, jobjectArray var VariantCopy(v, sink + idx); env->SetObjectArrayElement(vars, idx, newVariant); env->DeleteLocalRef(newVariant); + //Sourceforge-1674179 fix memory leak + // Variants received while iterating IEnumVARIANT must be cleared when no longer needed + // The variant has been copied so no longer needed + VariantClear(sink); } CoTaskMemFree(sink); return (jint)fetchCount; diff --git a/jni/Variant.cpp b/jni/Variant.cpp index 90c48b1..1e10e65 100644 --- a/jni/Variant.cpp +++ b/jni/Variant.cpp @@ -181,7 +181,9 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant return NULL; } // I am copying the pointer to java - if (ie) ie->AddRef(); + // SF-1674179 fix EnumVariants memory leak + // AJ: yes, but the QueryInterface call above already incremented the reference + //if (ie) ie->AddRef(); jobject newAuto = env->NewObject(autoClass, autoCons, ie); return newAuto; }