Tk Source Code

View Ticket
Login
Ticket UUID: 194c0b865024dd7157018b5dc618687dd92af1fc
Title: revised_text branch / tableList demo crash
Type: Bug Version: revised_text
Submitter: nab Created on: 2025-02-22 10:22:59
Subsystem: 78. Other Demos Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-10-22 17:22:35
Resolution: Duplicate Closed By: serhiy.storchaka
    Closed on: 2026-10-10 11:38:41
Description:
Hi,
while trying revised_text branch with the dirViewer.tcl demo of TableList I got this crash when I:
-deploy the / folder
-deploy the /Applications folder (it's a macOS)
-undeploy the / folder
-deploy the / folder (/Applications folder appears deployed)
-undeploy the /Applications folder

Assertion failed: (segPtr->sectionPtr), function TkTextIndexSetSegment, file tkTextIndex.c, line 459.
Process 80370 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert
    frame #4: 0x0000000100535fd0 Tk`TkTextIndexSetSegment.cold.4 at tkTextIndex.c:459:5 [opt]
   456 	    assert(indexPtr->tree);
   457 	    assert(segPtr);
   458 	    assert(segPtr->typePtr);    /* expired? */
-> 459 	    assert(segPtr->sectionPtr); /* linked? */
   460 	    assert(CheckLine(indexPtr, segPtr->sectionPtr->linePtr));
   461 	
   462 	    indexPtr->stateEpoch = TkBTreeEpoch(indexPtr->tree);
Target 0: (Wish) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert
    frame #0: 0x000000018d1cb720 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000018d203f70 libsystem_pthread.dylib`pthread_kill + 288
    frame #2: 0x000000018d110908 libsystem_c.dylib`abort + 128
    frame #3: 0x000000018d10fc1c libsystem_c.dylib`__assert_rtn + 284
  * frame #4: 0x0000000100535fd0 Tk`TkTextIndexSetSegment.cold.4 at tkTextIndex.c:459:5 [opt]
    frame #5: 0x00000001004b8524 Tk`TkTextIndexSetSegment(indexPtr=<unavailable>, segPtr=0x000000014479fc90) at tkTextIndex.c:459:5 [opt]
    frame #6: 0x00000001004aa488 Tk`LayoutDLine(indexPtr=0x000000016fdfdf90, displayLineNo=<unavailable>) at tkTextDisp.c:4492:2 [opt]
    frame #7: 0x00000001004a7e9c Tk`UpdateDisplayInfo(textPtr=<unavailable>) at tkTextDisp.c:5541:11 [opt]
    frame #8: 0x00000001004b0778 Tk`TkTextIndexBbox(textPtr=0x0000000143965610, indexPtr=0x000000016fdfe1a0, extents=0, xPtr=0x000000016fdfe23c, yPtr=0x000000016fdfe238, widthPtr=0x000000016fdfe234, heightPtr=0x000000016fdfe230, charWidthPtr=0x000000016fdfe198, thisChar=0x000000016fdfe19c) at tkTextDisp.c:12443:2 [opt]
    frame #9: 0x00000001004c0da0 Tk`TkTextGetCursorBbox(textPtr=0x0000000143965610, x=0x000000016fdfe23c, y=0x000000016fdfe238, w=0x000000016fdfe234, h=0x000000016fdfe230) at tkTextMark.c:2578:10 [opt]
    frame #10: 0x0000000100478a04 Tk`TextBlinkProc(clientData=0x0000000143965610) at tkText.c:6169:6 [opt]
    frame #11: 0x0000000100477724 Tk`TkConfigureText(interp=0x000000014401a610, textPtr=0x0000000143965610, objc=<unavailable>, objv=0x000000014401fa00) at tkText.c:4346:2 [opt]
    frame #12: 0x000000010047cd90 Tk`TextWidgetObjCmd(clientData=0x0000000143965610, interp=0x000000014401a610, objc=4, objv=0x000000014401f9f0) at tkText.c:1663:15 [opt]
    frame #13: 0x000000010069787c Tcl`Dispatch(data=<unavailable>, interp=0x000000014401a610, dummy4602=<unavailable>) at tclBasic.c:4640:12 [opt]
    frame #14: 0x000000010069579c Tcl`TclEvalEx at tclBasic.c:4656:11 [opt]
    frame #15: 0x000000010069574c Tcl`TclEvalEx [inlined] Tcl_EvalObjv(interp=0x000000014401a610, objc=3, objv=0x000000014401e990, flags=2097168) at tclBasic.c:4395:12 [opt]
    frame #16: 0x0000000100695728 Tcl`TclEvalEx(interp=<unavailable>, script="\n\tif {[winfo exists .tf.tbl.body.ind_k2,0]} {\n\t    foreach {tablelist::W tablelist::x tablelist::y}  [tablelist::convEventFields .tf.tbl.body.ind_k2,0 16 3] {}\n\t    if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} {\n\t\tcontinue\t;# on a vertical separator, outside the body\n\t    }\n\n\t    set tablelist::priv(x) $tablelist::x\n\t    set tablelist::priv(y) $tablelist::y\n\t    set tablelist::priv(row) [$tablelist::W nearest       $tablelist::y]\n\t    set tablelist::priv(col) [$tablelist::W nearestcolumn $tablelist::x]\n\t    set tablelist::priv(justClicked) 1\n\t    after 300 [list set tablelist::priv(justClicked) 0]\n\t    set tablelist::priv(clickedInEditWin) 0\n\t    if {[$tablelist::W cget -setfocus] &&\n\t\t[$tablelist::W cget -state] eq \"normal\"} {\n\t\tfocus [$tablelist::W bodypath]\n\t    }\n\t    if {[tablelist::wasExpCollCtrlClicked .tf.tbl.body.ind_k2,0 16 3]} {\n\t\tset tablelist::priv(clickedExpCollCtrl) 1\n\t\ttablelist::doFinishEditing $tablelist::W\n\t    } else {\n\t\ttablelist::condEditContainingCell $tablelist::W  $tablelis"..., numBytes=<unavailable>, flags=<unavailable>, line=2, clNextOuter=<unavailable>, outerScript="\n\tif {[winfo exists .tf.tbl.body.ind_k2,0]} {\n\t    foreach {tablelist::W tablelist::x tablelist::y}  [tablelist::convEventFields .tf.tbl.body.ind_k2,0 16 3] {}\n\t    if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} {\n\t\tcontinue\t;# on a vertical separator, outside the body\n\t    }\n\n\t    set tablelist::priv(x) $tablelist::x\n\t    set tablelist::priv(y) $tablelist::y\n\t    set tablelist::priv(row) [$tablelist::W nearest       $tablelist::y]\n\t    set tablelist::priv(col) [$tablelist::W nearestcolumn $tablelist::x]\n\t    set tablelist::priv(justClicked) 1\n\t    after 300 [list set tablelist::priv(justClicked) 0]\n\t    set tablelist::priv(clickedInEditWin) 0\n\t    if {[$tablelist::W cget -setfocus] &&\n\t\t[$tablelist::W cget -state] eq \"normal\"} {\n\t\tfocus [$tablelist::W bodypath]\n\t    }\n\t    if {[tablelist::wasExpCollCtrlClicked .tf.tbl.body.ind_k2,0 16 3]} {\n\t\tset tablelist::priv(clickedExpCollCtrl) 1\n\t\ttablelist::doFinishEditing $tablelist::W\n\t    } else {\n\t\ttablelist::condEditContainingCell $tablelist::W  $tablelis"...) at tclBasic.c:5495:13 [opt]
    frame #17: 0x00000001003e6498 Tk`Tk_BindEvent(bindPtr=<unavailable>, eventPtr=<unavailable>, tkwin=<unavailable>, numObjects=5, objArr=0x0000000145835010) at tkBind.c:2582:9 [opt]
    frame #18: 0x00000001003ef7d0 Tk`TkBindEventProc(winPtr=0x0000000144795610, eventPtr=0x0000000145bf7820) at tkCmds.c:320:5 [opt]
    frame #19: 0x00000001003f85bc Tk`Tk_HandleEvent(eventPtr=0x0000000145bf7820) at tkEvent.c:1276:6 [opt]
    frame #20: 0x00000001003f8cf0 Tk`WindowEventProc(evPtr=0x0000000145bf7810, flags=<unavailable>) at tkEvent.c:1707:5 [opt]
    frame #21: 0x000000010076241c Tcl`Tcl_ServiceEvent(flags=-3) at tclNotify.c:725:11 [opt]
    frame #22: 0x0000000100762718 Tcl`Tcl_DoOneEvent(flags=-3) at tclNotify.c:1024:6 [opt]
    frame #23: 0x00000001003f9290 Tk`Tk_MainLoop at tkEvent.c:2093:2 [opt]
    frame #24: 0x000000010040b218 Tk`Tk_MainEx(argc=-1, argv=<unavailable>, appInitProc=<unavailable>, interp=0x000000014401a610) at tkMain.c:377:5 [opt]
    frame #25: 0x0000000100006e78 Wish`main(argc=<unavailable>, argv=0x000000016fdff6a8) at tkAppInit.c:115:5 [opt]
    frame #26: 0x000000018ce84274 dyld`start + 2840

++
Nicolas
User Comments: serhiy.storchaka added on 2026-10-10 11:38:41:

Same crash as [73d8d94916] (same root cause as [ad458a3a72]); fixed on revised_text by [f80a5b2df7], with a remaining case in branch elide-walk-skipped-lines.


fvogel added on 2025-02-22 10:48:51:

This looks almost certainly a duplicate of [73d8d94916], which I believe to be a duplicate of [ad458a3a72]. I'm looking at the latter but it's a bit difficult.