Project

Profile

Help

Revision 5401a5ae

Added by O'Neil Delpratt almost 2 years ago

Saxon/C Development

View differences:

latest9.9/hec/Saxon.C.API/XdmValue.cpp
2 2
#include "XdmItem.h"
3 3
#include "XdmAtomicValue.h"
4 4
#include "XdmNode.h"
5
#include "XdmFunctionItem.h"
6
#include "XdmMap.h"
7
#include "XdmArray.h"
5 8

  
6 9
XdmValue::XdmValue(const XdmValue &other) {
7 10
	//SaxonProcessor *proc = other.proc; //TODO
......
103 106
			//value->addUnderlyingValue(resulti);
104 107

  
105 108
			if(SaxonProcessor::sxn_environ->env->IsInstanceOf(resulti, atomicValueClass)           == JNI_TRUE) {
106
				xdmItem = new XdmAtomicValue(resulti);
109
				xdmItem = new XdmAtomicValue(SaxonProcessor::sxn_environ->env->NewGlobalRef(resulti));
107 110
				
108 111

  
109 112
			} else if(SaxonProcessor::sxn_environ->env->IsInstanceOf(resulti, nodeClass)           == JNI_TRUE) {
110
				xdmItem = new XdmNode(resulti);
113
				xdmItem = new XdmNode(SaxonProcessor::sxn_environ->env->NewGlobalRef(resulti));
111 114

  
112 115

  
113 116
			} else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(resulti, functionItemClass)           == JNI_TRUE) {
114 117
			      //Not Supported yet
115 118
#if CVERSION_API_NO >= 123
116
				xdmItem = new XdmFunctionItem(resulti);
119
				xdmItem = new XdmFunctionItem(SaxonProcessor::sxn_environ->env->NewGlobalRef(resulti));
117 120
#endif
118 121
			}
119 122
			//xdmItem->setProcessor(proc);
120 123
			addXdmItem(xdmItem);
124
			SaxonProcessor::sxn_environ->env->DeleteLocalRef(resulti);
121 125
		}
122 126
	}
123 127
		SaxonProcessor::sxn_environ->env->DeleteLocalRef(results);
......
142 146
	}
143 147
	if (valueType != NULL) { delete valueType; }
144 148
	if (jValues && proc != NULL) {
145
		SaxonProcessor::sxn_environ->env->DeleteLocalRef(jValues);
149
		SaxonProcessor::sxn_environ->env->DeleteLocalRef(jValues);  //TODO check - this maybe should be DeleteGlobalRef  - check where it is created
146 150
	}
147 151
	xdmSize = 0;
148 152
	if(!toStringValue.empty()) {

Also available in: Unified diff