Tk Source Code

View Ticket
Login
Ticket UUID: 967f69e7b960fbf057a6735f393130cd48b4e4c1
Title: Memory leak fix - Text -undo being set to 1
Type: Bug Version: 8.6.6
Submitter: edhume3 Created on: 2017-08-09 00:38:52
Subsystem: 18. [text] Assigned To: fvogel
Priority: 7 High Severity: Minor
Status: Closed Last Modified: 2017-08-09 11:14:37
Resolution: Out of Date Closed By: fvogel
    Closed on: 2017-08-09 11:14:37
Description:
Ever since the initialization of the -undo widget option has been set to  TK_OPTION_DONT_SET_DEFAULT the -undo option has been initialized to 1 with the consequence of huge memory leakage with the Windows console implemented as a Text widget.  The problem is seen by
console eval {.console configure -undo} 
which shows the -undo is wrongfully set to 1.  

The fix is a one-liner - patch generic/tkText.c around line 550:
RCS file: /usr/cvsroot/tk8.6/generic/tkText.c,v
retrieving revision 1.2
retrieving revision 1.4
diff -c -3 -r1.2 -r1.4
*** tkText.c    25 Jul 2017 18:34:34 -0000      1.2
--- tkText.c    2 Aug 2017 15:02:49 -0000       1.4
***************

*** 547,553 ****
        Tcl_InitHashTable(&sharedPtr->windowTable, TCL_STRING_KEYS);
        Tcl_InitHashTable(&sharedPtr->imageTable, TCL_STRING_KEYS);
        sharedPtr->undoStack = TkUndoInitStack(interp,0);
!       sharedPtr->undo = 1;
        sharedPtr->isDirty = 0;
        sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
        sharedPtr->autoSeparators = 1;
--- 547,553 ----
        Tcl_InitHashTable(&sharedPtr->windowTable, TCL_STRING_KEYS);
        Tcl_InitHashTable(&sharedPtr->imageTable, TCL_STRING_KEYS);
        sharedPtr->undoStack = TkUndoInitStack(interp,0);
!       sharedPtr->undo = atoi(DEF_TEXT_UNDO);
        sharedPtr->isDirty = 0;
        sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
        sharedPtr->autoSeparators = 1;
User Comments: fvogel added on 2017-08-09 11:14:37:

Thank you for your report.

This has been already fixed, see [c8256e859a].