* Class: com_jacob_com_Variant * Method: zeroVariant * Signature: ()V * * This should only be used on variant objects created by the * com layer as part of a call through EventProxy. * This zeros out the variant pointer in the Variant object * so that the calling COM program can free the memory. * instead of both the COM program and the Java GC doing it. */
| 94 | * instead of both the COM program and the Java GC doing it. |
| 95 | */ |
| 96 | void zeroVariant(JNIEnv *env, jobject _this) |
| 97 | { |
| 98 | // sf 3435567 Fix a memory leak (detected with Glowcode) in Variant.cpp/zeroVariant function |
| 99 | // does this code conflict with the function/method documentation now? |
| 100 | // note that a related fix was proposed in SF 1689061 in EventProxy.cpp but never accepted |
| 101 | VARIANT *v = extractVariant(env, _this); |
| 102 | delete v; |
| 103 | |
| 104 | jclass clazz = env->GetObjectClass(_this); |
| 105 | jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "J"); |
| 106 | env->SetLongField(_this, jf, 0ll); |
| 107 | } |
| 108 | |
| 109 | |
| 110 | /** |
no test coverage detected