Project

Profile

Help

Revision 9e416749

Added by O'Neil Delpratt 6 months ago

Saxon/C seg error fix

View differences:

src/main/c/Saxon.C.API/SaxonProcessor.cpp
520 520
    procClass = other.procClass;
521 521
    saxonCAPIClass = other.saxonCAPIClass;
522 522
    cwd = other.cwd;
523
    proc = other.proc;
523
    proc = SaxonProcessor::sxn_environ->env->NewGlobalRef(other.proc);
524 524
    //SaxonProcessor::sxn_environ= other.environ;
525 525
    parameters = other.parameters;
526 526
    configProperties = other.configProperties;
......
534 534
    procClass = other.procClass;
535 535
    saxonCAPIClass = other.saxonCAPIClass;
536 536
    cwd = other.cwd;
537
    proc = other.proc;
537
    proc = SaxonProcessor::sxn_environ->env->NewGlobalRef(other.proc);
538 538
    //SaxonProcessor::sxn_environ= other.environ;
539 539
    parameters = other.parameters;
540 540
    configProperties = other.configProperties;
src/main/c/Saxon.C.API/XsltExecutable.cpp
44 44
XsltExecutable::~XsltExecutable() {
45 45
    clearProperties();
46 46
    clearParameters();
47
    if (selectionV != nullptr) {
48
        selectionV->decrementRefCount();
49
        if (selectionV->getRefCount() == 0) {
50
            delete selectionV;
51
        }
52
    } else {
53
        if (selection) {
54
            SaxonProcessor::sxn_environ->env->DeleteGlobalRef(selection);
55
        }
47

  
48
    if(selection) {
49
        SaxonProcessor::sxn_environ->env->DeleteGlobalRef(selection);
50
        selection = nullptr;
56 51
    }
52

  
57 53
    SaxonProcessor::sxn_environ->env->DeleteGlobalRef(executableObject);
58 54

  
59 55
}
......
256 252
            }
257 253
        }
258 254

  
259
        if(selection) {
260
            SaxonProcessor::sxn_environ->env->DeleteGlobalRef(selection);
261
            selection = nullptr;
262
        }
255

  
263 256
    } else {
264 257
        for (std::map<std::string, XdmValue *>::iterator itr = parameters.begin(); itr != parameters.end(); itr++) {
265 258

  
......
269 262
            }
270 263

  
271 264
        }
272
        if(selection) {
273
            SaxonProcessor::sxn_environ->env->DeleteGlobalRef(selection);
274
            selection = nullptr;
275
        }
265

  
276 266
    }
277 267
    parameters.clear();
278 268

  

Also available in: Unified diff