MCPcopy Create free account
hub / github.com/HelloBush/Java_MHXYdemo / zeroVariant

Function zeroVariant

lib/jacob-1.20_src/jacob-1.20/jni/Variant.cpp:96–107  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

94 * instead of both the COM program and the Java GC doing it.
95 */
96void 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/**

Callers 1

InvokeMethod · 0.85

Calls 1

extractVariantFunction · 0.85

Tested by

no test coverage detected