I found that in the middle of execution the result of [info library] was empty. To localize the problem, I called info library many times and at some call the result was empty, then back to normal. After setting a watch point on object result, I found that Ttk's procedure ThemeChangedProc called Tcl_GlobalEval without preserving Tcl result. Here's an example of stack where the result of [info library] is nullified:
[1] libtcl.so:ResetObjResult(iPtr = 0x85b03b8), line 968 in "tclResult.c"
[2] libtcl.so:Tcl_ResetResult(interp = (nil)), line 896 in "tclResult.c"
[3] libtcl.so:TclEvalEx(interp = 0x85b03b8, script = 0xf697895c "ttk::ThemeChanged", numBytes = 17, flags = 0, line = 1), line 4089 in "tclBasic.c"
[4] libtcl.so:Tcl_EvalEx(interp = 0x85b03b8, script = 0xf697895c "ttk::ThemeChanged", numBytes = -1, flags = 0), line 4043 in "tclBasic.c"
[5] libtcl.so:Tcl_Eval(interp = 0x85b03b8, script = 0xf697895c "ttk::ThemeChanged"), line 4823 in "tclBasic.c"
[6] libtcl.so:Tcl_GlobalEval(interp = 0x85b03b8, command = 0xf697895c "ttk::ThemeChanged"), line 5836 in "tclBasic.c"
[7] libtk.so:ThemeChangedProc(clientData = 0x860e818), line 519 in "ttkTheme.c"
[8] libtcl.so:TclServiceIdle(), line 738 in "tclTimer.c"
[9] libtcl.so:Tcl_DoOneEvent(flags = 34), line 991 in "tclNotify.c"
[10] libtk.so:MapFrame(clientData = 0x85d2c80), line 1751 in "tkFrame.c"
[11] libtcl.so:TclServiceIdle(), line 738 in "tclTimer.c"
[12] libtcl.so:Tcl_DoOneEvent(flags = -1), line 991 in "tclNotify.c"
[13] libeclutil.so:EventHandlerProc( = (nil), interp = 0x85b03b8, code = 0), line 367 in "gnm.C"
[14] libtcl.so:Tcl_AsyncInvoke(interp = 0x85b03b8, code = 0), line 240 in "tclAsync.c"
[15] libtcl.so:TclEvalObjvInternal(interp = 0x85b03b8, objc = 1, objv = 0x86723e0, command = (nil), length = 0, flags = 524288), line 3697 in "tclBasic.c"
[16] libtcl.so:Tcl_EvalObjv(interp = 0x85b03b8, objc = 1, objv = 0x86723e0, flags = 524288), line 3886 in "tclBasic.c"
[17] libtcl.so:NsEnsembleImplementationCmd(clientData = 0x85bf0e0, interp = 0x85b03b8, objc = 2, objv = 0x86722d8), line 6233 in "tclNamesp.c"
[18] libtcl.so:TclEvalObjvInternal(interp = 0x85b03b8, objc = 2, objv = 0x86722d8, command = 0x8088722 "info library] / $tcl_library"", length = 12, flags = 0), line 3690 in "tclBasic.c"
[19] libtcl.so:TclEvalEx(interp = 0x85b03b8, script = 0x8088722 "info library] / $tcl_library"", numBytes = 12, flags = 0, line = 1), line 4338 in "tclBasic.c"
[20] libtcl.so:TclSubstTokens(interp = 0x85b03b8, tokenPtr = 0x8671ee8, count = 4, tokensLeftPtr = (nil), line = 1), line 2254 in "tclParse.c"
[21] libtcl.so:TclEvalEx(interp = 0x85b03b8, script = 0x8088714 "puts "lib4 = [info library] / $tcl_library"", numBytes = 43, flags = 0, line = 1), line 4232 in "tclBasic.c"
[22] libtcl.so:Tcl_EvalEx(interp = 0x85b03b8, script = 0x8088714 "puts "lib4 = [info library] / $tcl_library"", numBytes = -1, flags = 0), line 4043 in "tclBasic.c"
[23] libtcl.so:Tcl_Eval(interp = 0x85b03b8, script = 0x8088714 "puts "lib4 = [info library] / $tcl_library""), line 4823 in "tclBasic.c"
I checked the latest Tk sources, 8.6b2, and the code of the function is the same.
After I added Tcl_SaveResult and Tcl_RestoreResult to the function, the problem is gone.
This change fixes the problem for me:
% cleartool diff -diff -pre ttkTheme.c
518c518,519
<
---
> Tcl_SavedResult state;
> Tcl_SaveResult (pkgPtr->interp, &state);
521a523
> Tcl_RestoreResult (pkgPtr->interp, &state);
You may want to preserve the whole state, not only result.
Good luck!
Please remove it, it is a result of refresh in my browser. Sorry and thanks.