Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: cfe3b7edad17d2dbf8673589ac10e15126025baf
Ticket: cac46925857f9928049828bc2e1552aa3842d2bd
Revised [text]: assertion failed in tkTextDisp.c:7191
User & Date: fvogel 2017-08-20 16:29:11
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    Revised [text]: assertion failed in tkTextDisp.c:7191
    
    Happens in TkTextUpdateLineMetrics(): 
    <verbatim>
        assert(lineNum <= endLine);
    </verbatim>
     
    Breakpointing at this place just before the assertion, one gets the following call stack:
    <verbatim>
    >	tk87tg.dll!TkTextUpdateLineMetrics(TkText * textPtr=0x03498e40, unsigned int lineNum=106, unsigned int endLine=106) 
    
     Line 7192	C
     	tk87tg.dll!UpdateLineMetrics(TkText * textPtr=0x03498e40, unsigned int startLine=106, unsigned int endLine=106)  
    
    Line 1253 + 0x11 bytes	C
     	tk87tg.dll!TextWidgetObjCmd(void * clientData=0x03498e40, Tcl_Interp * interp=0x006e2270, int objc=6, Tcl_Obj * 
    
    const * objv=0x006e6728)  Line 1873 + 0x17 bytes	C
     	tcl87tg.dll!Dispatch(void * * data=0x03bf62cc, Tcl_Interp * interp=0x006e2270, int result=0)  Line 4376 + 0x15 
    
    bytes	C
     	tcl87tg.dll!TclNRRunCallbacks(Tcl_Interp * interp=0x006e2270, int result=0, NRE_callback * rootPtr=0x00000000)  
    
    Line 4409 + 0x14 bytes	C
     	tcl87tg.dll!Tcl_EvalObjv(Tcl_Interp * interp=0x006e2270, int objc=3, Tcl_Obj * const * objv=0x006e64d0, int 
    
    flags=2097168)  Line 4139 + 0x11 bytes	C
     	tcl87tg.dll!TclEvalEx(Tcl_Interp * interp=0x006e2270, const char * script=0x034e3a40, int numBytes=109, int 
    
    flags=131072, int line=1, int * clNextOuter=0x00000000, const char * outerScript=0x034e3a40)  Line 5279 + 0x16 bytes	C
     	tcl87tg.dll!Tcl_EvalEx(Tcl_Interp * interp=0x006e2270, const char * script=0x034e3a40, int numBytes=109, int 
    
    flags=131072)  Line 4943 + 0x1d bytes	C
     	tk87tg.dll!Tk_BindEvent(Tk_BindingTable_ * bindPtr=0x00730378, _XEvent * eventPtr=0x032e8858, Tk_Window_ * 
    
    tkwin=0x0337a5a0, int numObjects=0, void * * objectPtr=0x002bfb84)  Line 1505 + 0x27 bytes	C
     	tk87tg.dll!TkBindEventProc(TkWindow * winPtr=0x0337a5a0, _XEvent * eventPtr=0x032e8858)  Line 317 + 0x1f bytes	C
     	tk87tg.dll!Tk_HandleEvent(_XEvent * eventPtr=0x032e8858)  Line 1374 + 0xd bytes	C
     	tk87tg.dll!WindowEventProc(Tcl_Event * evPtr=0x032e8850, int flags=-3)  Line 1764 + 0xc bytes	C
     	tcl87tg.dll!Tcl_ServiceEvent(int flags=-3)  Line 670 + 0xd bytes	C
     	tcl87tg.dll!Tcl_DoOneEvent(int flags=-3)  Line 967 + 0x9 bytes	C
     	tk87tg.dll!Tk_MainLoop()  Line 2148 + 0x11 bytes	C
     	tk87tg.dll!Tk_MainExW(int argc=-1, unsigned short * * argv=0x003b32d8, int (Tcl_Interp *)* appInitProc=0x004010e0, 
    
    Tcl_Interp * interp=0x006e2270)  Line 391	C
     	wish87tg.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, unsigned short * 
    
    lpszCmdLine=0x006a16b6, int nCmdShow=10)  Line 150 + 0x39 bytes	C
     	wish87tg.exe!__tmainCRTStartup()  Line 574 + 0x35 bytes	C
     	wish87tg.exe!wWinMainCRTStartup()  Line 399	C
     	kernel32.dll!7642f964() 	
     	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
     	ntdll.dll!7703e369() 	
     	ntdll.dll!7703e57b() 	
    </verbatim>
    
    This shows that the command currently executed was ".text count -ypixels", with the "indexFrom" and "indexTo" being identical, which triggers the assertion.
    
    The call to:
    <verbatim>
        UpdateLineMetrics(textPtr, from, to);
    </verbatim>
    in tkText.c:1873 surely does not need to be done  if (indexFrom == indexTo)
    
    Perhaps adding this test would be enough to fix the issue.
    
    This is fully repeatable in my application. I can try to produce a short demo script if needed.
    
  5. foundin changed to: "revised_text"
  6. is_private changed to: "0"
  7. login: "fvogel"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "a013af67114eccc19ad12b04f14923acea9e96b7"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "fvogel"
  14. subsystem changed to: "18. [text]"
  15. title changed to:
    Revised [text]: assertion failed in tkTextDisp.c:7191
    
  16. type changed to: "Bug"