Project

Profile

Help

Revision ae39487d

Added by O'Neil Delpratt almost 6 years ago

Bug fix relating to issue 2670

View differences:

latest9.6/hec/Saxon.C.API/SaxonProcessor.cpp
30 30
const char * failure;
31 31
sxnc_environment * SaxonProcessor::environ = 0;
32 32
int SaxonProcessor::refCount = 0;
33
int SaxonProcessor::jvmCreatedCPP=0;
33 34

  
34 35
bool SaxonProcessor::exceptionOccurred(){
35 36
	return environ->env->ExceptionCheck();
......
48 49
    SaxonProcessor(licensei);
49 50
}
50 51

  
51
int SaxonProcessor::jvmCreatedCPP=0;
52

  
52 53

  
53 54
//TODO - Exception handling in Saxon/C on both Java side and C++ side does not correctly handle multiple exceptions
54 55
//This needs working on in the next release
......
134 135
    refCount++;
135 136

  
136 137

  
137

  
138 138
     if(jvmCreatedCPP == 0){
139 139
	jvmCreatedCPP=1;
140
std::cerr<<"SaxonProc constructor: jvm created!"<<jvmCreatedCPP<<" refCount="<<refCount<<std::endl;
140 141
    environ = new sxnc_environment;//(sxnc_environment *)malloc(sizeof(sxnc_environment));
141 142

  
142 143
    /*
......
176 177
    versionStr = NULL;
177 178
    refCount++;
178 179

  
179
     if(!environ){
180
    if(jvmCreatedCPP == 0){
181
	jvmCreatedCPP=1;
180 182
    //environ = new sxnc_environment;
181 183
	environ = (sxnc_environment *)malloc(sizeof(sxnc_environment));
182 184

  
......
223 225

  
224 226
    SaxonProcessor::~SaxonProcessor(){
225 227
	clearConfigurationProperties();
228
	if(versionStr != NULL) {
229
		delete versionStr;
230
	}
226 231
	refCount--;	//The might be redundant due to the bug fix 2670
227 232
   }
228 233

  
......
447 452

  
448 453

  
449 454
void SaxonProcessor::release(){
450
//std::cerr<<"SaxonProc: release called!"<<std::endl;
451
	if(jvmCreatedCPP!=0) {
452
//std::cerr<<"SaxonProc: jvmCreatedCPP!"<<std::endl;
453
		jvmCreatedCPP =0;
455
	if(SaxonProcessor::jvmCreatedCPP!=0) {
456
		SaxonProcessor::jvmCreatedCPP =0;
454 457

  
455
 		finalizeJavaRT (environ->jvm);
458
 		finalizeJavaRT (SaxonProcessor::environ->jvm);
456 459

  
457 460
		//delete environ ;
458 461
	/*clearParameters();
459 462
	clearProperties();*/
460 463
} else {
461
//#ifdef DEBUG
464
#ifdef DEBUG
462 465
     std::cerr<<"SaxonProc: JVM finalize not called!"<<std::endl;
463
//#endif
466
#endif
464 467
}
465 468
}
466 469

  

Also available in: Unified diff