Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a245e8e5ce0cf327856ac48f137671498097b688
Ticket: 2688063fffffffffffffffffffffffffffffffff
segfault in test error-9.5 (try)
User & Date: ferrieux on 2009-03-16 16:04:54
Changes

  1. icomment:
    Thanks Joe for this detailed output, it makes the bug obvious !
    What happens is the following:
    (1) handlersObj contains a list of sublists, tried each in turn (handlers[i]).
    (2) when the matching one is found, its elements pointer is extracted into "info".
    (3) that info contains the handlerObj as info[0], whose refcount is incr'ed
    (4) then we decr the refcount of the handlersObj list, and handlerObj survives, but not the intermediary level handlers[i]
    (5) then info[] is stale at the point where we use info[4]
    
    The attached trivial patch just copies info[4] in a local until its use.
    From my tests it seems that the associated Tcl_Obj has a refcount high enough so that it survives the decrrefcount of the whole tree, but I'm not sure.
    A better solution would be to IncrRefCount(handlers[i]), but I daren't do that because I don't know the best point to DecrRefCount it afterwards.
    
    Please Donal and Joe, review ;-)
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"