With SWIG (2.0, wrapping with the -tcl and -c++ flags) wrapped object code in tclsh (8.5)...
I have a wrapped class A. On creation it generates a thread that does some background work. On destruction it joins with the spawned thread and dies a happy object.
#!/usr/bin/env tclsh
A a
a -delete ; # or rename a ""
exit
On the other hand, death without notice results in violent throes:
#!/usr/bin/env tclsh
A a
exit ; # <-- There's a segfault here; 'a' never got the memo to clean up
I'm inclined to say this is a bug on SWIG's end due to this behavior not being mentioned in the 2.0 docs in the last bit of section 37.3.6 or in section 37.3.7. At the very least, I think the docs should mention this.
Woop - forgot to specify minor version number. 2.0.9.
I'm going to commit the following to address this - it'll be in SWIG 4.2.0: