Project

Profile

Help

Revision 00082f6f

Added by O'Neil Delpratt 8 months ago

Saxon/C bug fixes

View differences:

src/main/c/Saxon.C.API/XdmValue.cpp
147 147
	if (valueType != nullptr) { delete valueType; }
148 148
	if (jValues) {
149 149
        std::cout<<"xdmValue jni"<<getRefCount()<<std::endl;
150
		SaxonProcessor::sxn_environ->env->DeleteLocalRef(jValues);  //TODO check - this maybe should be DeleteGlobalRef  - check where it is created
150
		SaxonProcessor::sxn_environ->env->DeleteLocalRef(jValues);
151 151
	}
152 152
	xdmSize = 0;
153 153

  
......
165 165
		values.push_back(val);
166 166
        val->incrementRefCount();
167 167
		xdmSize++;
168
		jValues = nullptr; //TODO clear jni array from memory if needed
168
        if (jValues) {
169
            std::cout<<"xdmValue jni"<<getRefCount()<<std::endl;
170
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(jValues);  //TODO check - this maybe should be DeleteGlobalRef  - check where it is created
171
            jValues = nullptr;
172
        }
173

  
169 174
	}
170 175
}
171 176

  
......
212 217
		}
213 218
		jclass objectClass = lookForClass(env,
214 219
			"net/sf/saxon/s9api/XdmItem");
215
		jValues = (jobjectArray)env->NewObjectArray((jint)count, objectClass, 0);
220
		jobjectArray jValuesi = (jobjectArray)env->NewObjectArray((jint)count, objectClass, 0);
221

  
216 222

  
217 223
		for (i = 0; i < count; i++) {
218
			env->SetObjectArrayElement(jValues, i, values[i]->getUnderlyingValue());
224
			env->SetObjectArrayElement(jValuesi, i, values[i]->getUnderlyingValue());
219 225
		}
226
        jValues = (jobjectArray)SaxonProcessor::sxn_environ->env->NewGlobalRef(jValuesi);
220 227
	} 
221 228
	return (jobject)jValues;
222 229
}

Also available in: Unified diff