Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 804aa0b9a5230f9e6deabb1864b39c1c7ec62037
Ticket: 473875ffffffffffffffffffffffffffffffffff
nextPtr init in Tk_GetCursorFromData()
User & Date: nobody on 2001-10-23 02:20:25
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Tk_GetCursorFromData() does not initialize nextPtr
    field to NULL when allocating a new Tk_Cursor object.
    If the allocated memory is not automatically 
    initialized, it'll cause a problem later when 
    another cursor is allocated from the same data
    after this cursor is destroyed. I.e.:
    
    a = Tk_GetCursorFromData(...);
    ...
    Tk_FreeCursor(a);
    ...
    /* b is allocated using the same setup as a */
    b = Tk_GetCursorFromData(...); /* seg fault */
    
    This was found with hiertable in blt2.4u.
    
    Solution: apply the following patch to generic/tkCursor.c:
    
    --- tkCursor.c.oldMon Oct 22 19:16:41 2001
    +++ tkCursor.cMon Oct 22 18:57:37 2001
    @@ -384,6 +384,8 @@
         cursorPtr->objRefCount = 0;
         cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable, 
                 (char *) cursorPtr->cursor, &new);
    +    /* XXX Set nextPtr to NULL ! */
    +    cursorPtr->nextPtr = NULL;
     
         if (!new) {
     panic("cursor already registered in Tk_GetCursorFromData");
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "None"
  10. title changed to: "nextPtr init in Tk_GetCursorFromData()"
  11. type changed to: "Patch"