From: SourceForge.net <no...@so...> - 2006-03-25 22:36:55
|
Bugs item #1414171, was opened at 2006-01-25 00:47 Message generated for change (Comment added) made by vincentdarley You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1414171&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: 18. [text] Group: obsolete: 8.4.9 Status: Open Resolution: Out of Date Priority: 8 Submitted By: Peter MacDonald (pcmacdon) Assigned to: Vince Darley (vincentdarley) Summary: Text widget dumps core with -command option Initial Comment: The text widget can be made to dump core with the following simple script (on 8.4.9 on Linux), when the dump -command is used where the command adds a tag. With more complex scripts 8.3 and 8.5 also dump core. Below is the coredump traceback which seems to show that segPtr->typePtr->name has been invalidated. ########################################### pack [text .t] .t insert end "abc\n" a "---" {} "def" b " \n" {} "ghi\n" c .t tag configure b -background red proc Dumpy {key value index} { puts "KK: $key, $value" if {$value == "b" && $key == "tagon"} { puts TAGGING .t tag add $value [list $index linestart] [list $index lineend] } } .t dump -all -command Dumpy 1.0 end ############################################## #0 0x080c18af in DumpLine (interp=0x8132660, textPtr=0x81c9e90, what=31, linePtr=0x8178430, startByte=0, endByte=32000000, lineno=1, command=0x81c1218 "Dumpy") at /home/pcmacdon/Tcl/tk8.4.9/unix/../generic/tkText.c:2654 2654 if ((what & TK_DUMP_MARK) && (segPtr->typePtr->name[0] == 'm')) { (gdb) p segPtr $1 = (TkTextSegment *) 0x81760f8 (gdb) p segPtr->typePtr $2 = (struct Tk_SegType *) 0x6c2f7273 (gdb) p segPtr->typePtr->name Cannot access memory at address 0x6c2f7273 (gdb) p what $3 = 31 (gdb) bt #0 0x080c18af in DumpLine (interp=0x8132660, textPtr=0x81c9e90, what=31, linePtr=0x8178430, startByte=0, endByte=32000000, lineno=1, command=0x81c1218 "Dumpy") at /home/pcmacdon/Tcl/tk8.4.9/unix/../generic/tkText.c:2654 #1 0x080c16f1 in TextDumpCmd (textPtr=0x81c9e90, interp=0x8132660, argc=7, argv=0xbfffeeb8) at /home/pcmacdon/Tcl/tk8.4.9/unix/../generic/tkText.c:2582 #2 0x080be1d4 in TextWidgetCmd (clientData=0x81c9e90, interp=0x8132660, argc=7, argv=0xbfffeeb8) at /home/pcmacdon/Tcl/tk8.4.9/unix/../generic/tkText.c:849 #3 0x40034417 in TclInvokeStringCommand () from /home/pcmacdon/usr/lib/libtcl8.4.so #4 0x400354c7 in TclEvalObjvInternal () from /home/pcmacdon/usr/lib/libtcl8.4.so #5 0x40035f1d in Tcl_EvalEx () from /home/pcmacdon/usr/lib/libtcl8.4.so #6 0x40072093 in Tcl_FSEvalFile () from /home/pcmacdon/usr/lib/libtcl8.4.so #7 0x40071157 in Tcl_EvalFile () from /home/pcmacdon/usr/lib/libtcl8.4.so #8 0x0805635f in Tk_MainEx (argc=1, argv=0xbffff518, appInitProc=0x8055fbc <Tcl_AppInit>, interp=0x8132660) at /home/pcmacdon/Tcl/tk8.4.9/unix/../generic/tkMain.c:242 #9 0x08055fa4 in main (argc=2, argv=0xbffff514) at /home/pcmacdon/Tcl/tk8.4.9/unix/tkAppInit.c:68 #10 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6 ---------------------------------------------------------------------- >Comment By: Vince Darley (vincentdarley) Date: 2006-03-25 22:36 Message: Logged In: YES user_id=32170 Please test the attached patch for cvs head. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2006-03-25 19:49 Message: Logged In: NO I suspect this can be fixed by keeping track of whether the widget has been touched when '-command' is called, and if so, recomputing all the internal objects (TkTextLine*, etc) from the current index position. -- Vince. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2006-03-23 18:44 Message: Logged In: YES user_id=80530 thanks for re-verifying. Since there's a workaround (don't modify the widget during a dump), I'm going to drop prio a bit to no longer block release. Still hope the [text] maintainers will take a look, though. ---------------------------------------------------------------------- Comment By: Peter MacDonald (pcmacdon) Date: 2006-03-23 18:38 Message: Logged In: YES user_id=190660 Test script ---------------------------------------------------------------------- Comment By: Peter MacDonald (pcmacdon) Date: 2006-03-23 18:35 Message: Logged In: YES user_id=190660 Same here: the previous test script no longer triggers the problem in 8.4.13rc0. But the attached script triggers the seg-fault, in all versions of Tk 8.3-8.5. The only change: removal of the if statement so a tag is always added. The bottom line: adding a tag while in the middle of a dump -command is bad news. I suspect that any real resolution of this problem will require locking out all modifications to the widget during [.t dump]. To that end, I tried altering the state to disabled, but the crash still occurs because [.t tag add] allows changes even during disabled state. Thus, unless you are willing to change the observable behavior of [text], an inDump flag will probably need to added to textPtr to lock out all changes. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2006-03-23 17:28 Message: Logged In: YES user_id=80530 No crash for me with the 8.4.13 candidate releases. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1414171&group_id=12997 |