Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7104ccd2367beac494336ef8026572cdbabffdb4
Ticket: 969358ffffffffffffffffffffffffffffffffff
Using -maxundo causes segfault in Text widget
User & Date: jiangwu on 2004-06-09 04:01:15
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    After setting the -maxundo option in the text widget, a 
    memory violation happens when number of undo 
    operations exceeds this maximum bound.
    
    Using tcl 8.4.6 with memory debugging on, do this:
    
    text .t -undo 1 -autoseparator 1 -maxundo 2
    pack .t -expand 1 -fill both
    .t insert end <some block of text>
    
    1. select a portion of the text and do "Control-X"
    2. do "Control-V" to paste back.
    3. select another block of text an do "Control-X", the 
    program crashes.
    
    The bug is in tkUndo.c, line 205.  The loop to free undo 
    element is incorrect.  Patch to fix is this:
    
    Index: generic/tkUndo.c
    ==========================================
    =========================
    RCS 
    file: /home/cvs/starvine/cvsroot/tk/generic/tkUndo.c,v
    retrieving revision 1.3
    diff -u -r1.3 tkUndo.c
    --- generic/tkUndo.c    9 Mar 2004 08:23:25 -0000       
    1.3
    +++ generic/tkUndo.c    9 Jun 2004 03:52:01 -0000
    @@ -205,7 +205,7 @@
             while ( elem ) {
                prevelem = elem;
                elem = elem->next;
    -           ckfree((char *) elem);
    +           ckfree((char *) prevelem);
             }
             stack->depth = stack->maxdepth;
         }
    
    
  4. foundin changed to: "obsolete: 8.4.6"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "jiangwu"
  9. subsystem changed to: "41. Memory Allocation"
  10. title changed to: "Using -maxundo causes segfault in Text widget"
  11. type changed to: "Bug"