Bug #2772
closedStatic variable environ resetting its value to zero and crashes Python test
100%
Description
The static variable environ is being reset to zero in multi-threaded applications. Reproduced in a python test: testXPathSingle.
Bug issue started in https://saxonica.plan.io/boards/4/topics/6413:
The problem and solution to this problem is described here: http://stackoverflow.com/questions/4448296/static-variable-resetting-its-value-to-0-on-its-own-apparently
The variable is identified as static:
static sxnc_environment * environ;
which means each compilation unit will get its own copy of the variable. Instead it should be declare with extern in the header file:
extern static sxnc_environment * environ;
and initialise it in the implementation file
sxnc_environment * SaxonProcessor::environ = 0;
Updated by O'Neil Delpratt over 8 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
The same fix should be applied to the static variable jvmCreatedCPP.
Bug fixed and committed to subversion
Updated by O'Neil Delpratt over 8 years ago
The initial fix did not work because you cannot mix extern and static in C++. I reverted back to using static variables.
The fix was to make the method getStringValue in XdmItem as virtual.
Updated by O'Neil Delpratt over 8 years ago
- Fixed in version set to 1.0.2
Bug fix applied in the Saxon/C 1.0.2 maintenance release
Updated by O'Neil Delpratt over 8 years ago
- Status changed from Resolved to Closed
Please register to edit this issue