Project

Profile

Help

Revision a69dd173

Added by O'Neil Delpratt 6 months ago

Saxon/C update

View differences:

src/main/c/Saxon.C.API/XdmItem.cpp
16 16
XdmItem::XdmItem(jobject obj){
17 17
	value = obj;
18 18
	xdmSize =1;
19
	refCount =1;
19
	refCount =0;
20 20
}
21 21

  
22 22
bool XdmItem::isAtomic(){
......
63 63
	return value;
64 64
}
65 65

  
66
    const char * XdmItem::getStringValue(){
66
    const char * XdmItem:: getStringValue(){
67 67
        if(stringValue.empty()) {
68 68
    		jclass xdmItemClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmItem");
69 69
    		jmethodID sbmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmItemClass,
......
95 95
	}
96 96

  
97 97
XdmItem::~XdmItem() {
98
    //std::cerr<<std::endl<<"XdmItem destructor called, refCount"<<getRefCount()<<std::endl;
98
    decrementRefCount();
99
    std::cerr<<std::endl<<"XdmItem destructor called, refCount"<<getRefCount()<<std::endl;
99 100
    if(getRefCount()<1){
100 101
        if(value !=nullptr && SaxonProcessor::jvmCreatedCPP>0) {
101 102
            SaxonProcessor::sxn_environ->env->DeleteGlobalRef(value);
102 103
        }
103
        free(value);
104

  
104 105
        if(stringValue.empty()) {
105 106
            stringValue.clear();
106 107
        }

Also available in: Unified diff