From: SourceForge.net <no...@so...> - 2011-12-16 13:52:17
|
Bugs item #3460403, was opened at 2011-12-15 14:44 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3460403&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 88. Themed Tk Group: obsolete: 8.5.8 Status: Open Resolution: None >Priority: 8 Private: No Submitted By: Yevgen Ryazanov (eugene_cdn) Assigned to: Joe English (jenglish) Summary: Ttk async proc resets result of a command in main script Initial Comment: 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! ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2011-12-16 05:52 Message: Seems like a reasonable analysis and the right general sort of fix. Elevating priority. I've converted the suggested change to a patch that uses the Tcl 8.5 Tcl_InterpState API (which deals with more tricky cases than the Tcl_SavedResult API does) and attached it. (For future reference, unified diffs are hugely easier to review as they include some context. No idea if clearcase can generate them though.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3460403&group_id=12997 |