Ticket UUID: | cac46925857f9928049828bc2e1552aa3842d2bd | |||
Title: | Revised [text]: assertion failed in tkTextDisp.c:7191 | |||
Type: | Bug | Version: | revised_text | |
Submitter: | fvogel | Created on: | 2017-08-20 16:29:11 | |
Subsystem: | 18. [text] | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2017-08-27 19:04:44 | |
Resolution: | Fixed | Closed By: | fvogel | |
Closed on: | 2017-08-27 19:04:44 | |||
Description: |
Revised [text]: assertion failed in tkTextDisp.c:7191 Happens in TkTextUpdateLineMetrics(): assert(lineNum <= endLine); Breakpointing at this place just before the assertion, one gets the following call stack: > 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() This shows that the command currently executed was ".text count -update -ypixels", with the "indexFrom" and "indexTo" being identical, which triggers the assertion. The call to: UpdateLineMetrics(textPtr, from, to);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. | |||
User Comments: |
gcramer added on 2017-08-27 16:06:27:
Thanks for the information, I did an upgrade to Fossil 12.3. I've committed [c694fc877a] with an additional fix, UpdateLineMetrics() should be called with from < to. fvogel added on 2017-08-27 15:21:24: I saw this also during the past week. I didn't try to investigate the root cause and Google did not spot relevant matches. I noticed that I was using an old fossil version (1.2 IIRC, that is available from the Debian stable repo) and upgraded it to he latest 2.3 Problem vanished then. gcramer added on 2017-08-27 14:56:40: Yes, your fix is okay, but I see there is another bug at this place, it must be ensured that from < to, thus I've made a different fix. But currently I have a big problem, I cannot commit, Fossil gives the following output: Autosync: http://[email protected]/tk Round-trips: 1 Artifacts sent: 0 received: 0 unknown command: [igot] I'm using a different network as before, is this a problem for Fossil? fvogel added on 2017-08-20 16:35:42: The following patch prevents the assertion from triggering in the situation I can otherwise make it trigger repeatably in my application: Index: generic/tkText.c ================================================================== --- generic/tkText.c +++ generic/tkText.c @@ -1865,11 +1865,11 @@ break; case 'y': if (strncmp("-ypixels", option, length) == 0) { int from, to; - if (update) { + if (update && (TkTextIndexCompare(&indexFrom, &indexTo) != 0)) { from = TkTextIndexGetLineNumber(&indexFrom, textPtr); to = TkTextIndexGetLineNumber(&indexTo, textPtr); UpdateLineMetrics(textPtr, from, to); } from = TkTextIndexYPixels(textPtr, &indexFrom); Is this correct, or is there a better fix? |