Tk Source Code

View Ticket
Login
Ticket UUID: 4121b417d9c2ce765bdc54a1b09a05dd974c5457
Title: Text widget crashes when changing font on MacOS
Type: Bug Version: 8.6.8
Submitter: anonymous Created on: 2018-04-18 10:24:33
Subsystem: 18. [text] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2020-07-07 13:56:30
Resolution: Out of Date Closed By: kevin_walzer
    Closed on: 2020-07-07 13:56:30
Description:

When changing the font in TkChat on MacOS High Sierra, a segmentation fault occurs. I have not been able to create a minimal crashing script, but the following works reliably:

  1. Open TkChat and login
  2. Change font to Arial 14 point
  3. Tk crashes.

The backtrace indicates a crash in `Tcl_DStringSetLength`.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x24)
  * frame #0: 0x0000000100182e2e libtcl8.6.dylib`Tcl_DStringSetLength + 20
    frame #1: 0x0000000104a1347d libtk8.6.dylib`CharUndisplayProc + 95
    frame #2: 0x0000000104a0bd3b libtk8.6.dylib`FreeDLines + 222
    frame #3: 0x0000000104a10315 libtk8.6.dylib`TkTextRelayoutWindow + 157
    frame #4: 0x0000000104a048da libtk8.6.dylib`TextEventProc + 233
    frame #5: 0x000000010499d14a libtk8.6.dylib`Tk_HandleEvent + 1032
    frame #6: 0x00000001049b886a libtk8.6.dylib`TkDoConfigureNotify + 134
    frame #7: 0x00000001049a454a libtk8.6.dylib`Tk_MaintainGeometry + 582
    frame #8: 0x00000001049a9031 libtk8.6.dylib`ArrangeGrid + 754
    frame #9: 0x000000010017b2c2 libtcl8.6.dylib`TclServiceIdle + 75
    frame #10: 0x000000010015f5c4 libtcl8.6.dylib`Tcl_DoOneEvent + 338
    frame #11: 0x000000010499db2e libtk8.6.dylib`Tk_MainLoop + 33
    frame #12: 0x000000010015a61c libtcl8.6.dylib`Tcl_MainEx + 1700
    frame #13: 0x0000000100001a3d tclsh`main + 37
    frame #14: 0x00007fff66125015 libdyld.dylib`start + 1

The following small change prevents the crash (but might have unintended effects)

Index: macosx/tkMacOSXInt.h
==================================================================
--- macosx/tkMacOSXInt.h
+++ macosx/tkMacOSXInt.h
@@ -180,12 +180,12 @@

/* * Defines for tkTextDisp.c */

-#define TK_LAYOUT_WITH_BASE_CHUNKS 1 -#define TK_DRAW_IN_CONTEXT 1 +#define TK_LAYOUT_WITH_BASE_CHUNKS 0 +#define TK_DRAW_IN_CONTEXT 0

/* * Prototypes of internal procs not in the stubs table. */

User Comments: kevin_walzer added on 2020-07-07 13:56:30:
No longer present.

mjanssen added on 2018-04-25 07:29:39:
I can't reproduce with latest tkchat from http://core.tcl.tk/tclapps/ but that was with a different monitor config which I think might be related. I will check to confirm what I found.

kevin_walzer added on 2018-04-21 13:06:59:
Still can't reproduce this with a new build of TkChat against the tip of core-8-6-branch. I am also on macOS 10.13.4.

mjanssen added on 2018-04-21 09:59:40:
I may be relevant that this happens on the latest version of High Sierra

kevin_walzer added on 2018-04-18 12:52:26:
Can't reproduce here, maybe this has been fixed already? The current build of TkChat is a bit outdated. Let me post a new build of TkChat today or tomorrow and see if that works for you.