Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 84c2377b22c1cc36bb681e88ea46e67ff6669eb8
Ticket: 578617ffffffffffffffffffffffffffffffffff
Tcl_FSCreateDirectory() aborts
User & Date: vincentdarley on 2002-07-08 17:59:55
Changes

  1. icomment:
    Logged In: YES 
    user_id=32170
    
    This obviously isn't ideal, but calling Tcl_FSAnything in 
    that way is clearly going to leak memory even if the 
    result succeeds.  The docs explicitly say that you 
    should not call these APIs with refCounts of zero:
    
    "The \fBTcl_FS...\fR are objectified and may cache 
    internal
    representations and other path-related strings (e.g. the 
    current
    working directory).  One side-effect of this is that one 
    must be
    careful when passing in temporary objects with a 
    refCount of zero. 
    Under some circumstances, the filesystem code may 
    wish to retain a
    reference to the passed in object, and so one must not 
    assume that
    after any of these calls return, the object still has a 
    refCount of
    zero - it may have been incremented.  The practical 
    lesson to learn
    from this is that \fBTcl_Obj *path = Tcl_NewStringObj
    (...) ;
    Tcl_FS...(path) ; Tcl_DecrRefCount(path)\fR is wrong, 
    and may
    segfault.  The 'path' must have its refCount incremented 
    before
    passing it in, or decrementing it."
    
    I'll try to fix the crash in any case...
    
    
  2. login: "vincentdarley"
  3. mimetype: "text/plain"
  4. username: "vincentdarley"