Using a speedtable shared library from two interpreters in the same process leads to a crash
lehenbauer opened this issue · comments
All the field names get created as static Tcl_Objs, plus an array of pointers to all the field names plus a default empty string object and a null value object. This causes the objects to get used between the two interprteters, which is a no-no, and will lead to objects getting freed that are still in use by the other interpreter and probably other stuff, resulting in a crash.
These statics need to be bundled up into a struct, allocated and initialized per interpreter and associated with the interpreter using Tcl_SetAssocData and referenced from the interpreter using Tcl_GetAssocData.
This'll be tricky.
Is this what the multiterp branch intends to fix?
https://github.com/flightaware/speedtables/tree/multiterp