Skip to content
Tcl Source Code History Of Ticket 2931244fffffffffffffffffffffffffffffffff
Login

History Of Ticket 2931244fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 2931244fffffffffffffffffffffffffffffffff

  1. Ticket change [6f6f3ed3a2] (rid 100317) by azaroo on 2010-01-13 09:27:32:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      This does not happen on tcl8.5.7.
      Please see the attached testcase.
      
      just start tclsh
      
      % package require testPackage
      % exit
      And the crash occurs.
      
      
    4. foundin initialized to: "obsolete: 8.5.8"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "azaroo"
    10. subsystem initialized to: "10. Objects"
    11. title initialized to: "TCL 8.5.8 crashes on exit"
    12. type initialized to: "Bug"
  2. Add attachment "tclCrash858.tgz" [d66f87fee6] (rid 123805) by azaroo on 2010-01-13 16:27:35.

  3. Ticket change [4fccd84c80] (rid 125885) by azaroo on 2010-01-13 16:27:35:

    1. icomment:
      
      
      File Added - 358788: tclCrash858.tgz
      
      
      
    2. login: "azaroo"
    3. mimetype: "text/plain"
    4. username: "azaroo"
  4. Ticket change [57ab6f38a9] (rid 117658) by ferrieux on 2010-01-13 18:16:02:

    1. icomment:
      A bit of human-readable context would be appreciated.
      Basically you need a specific behavior from an extension to crash.
      Please summarize it.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  5. Ticket change [461f54326d] (rid 99470) by azaroo on 2010-01-13 18:31:57:

    1. icomment:
      I am not good at it, but let me try!
      1. You need to compile the cpp file into a dll and modify the pkgIndex.tcl file accordingly to load the package.
      2. The tclsh was compiled without threads.
      
      The Crash Happens in the destructor
        ~TclFileHandles() {
           Tcl_UnregisterChannel(0, chann);
           Tcl_FSDeleteFile(channFileName);
           Tcl_DecrRefCount(channFileName);
          if (fp) { // hack as mentioned above
            fclose(fp); unlink(fpFileName.c_str());
          }
        }
       on Tcl_DecrRefCount(channFileName);
      
      In a debugger, I could track it down to TclFreeObj function call where this problem was manifesting itself.
      
      If you want some other info do let me know!
      
      Regards,
      
      
      
    2. login: "azaroo"
    3. mimetype: "text/plain"
    4. username: "azaroo"
  6. Ticket change [635d7caaf3] (rid 92563) by ferrieux on 2010-01-13 21:12:33:

    1. icomment:
      Uh, what I don't see is the link between the Tcl/extension API (XXX_Init and XXX_unload) and your C++ class's constructor and destructor. Maybe a file is missing ? Otherwise, how do you ensure that the constructor is called by Test_Init and (more importantly) the destructor by Test_Unload ?
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  7. Ticket change [92a07a9f24] (rid 120794) by azaroo on 2010-01-13 21:52:04:

    1. icomment:
      Ok!
      Basically the load library call loads the dll and that is all is required. The Test_Init is just a stub and does not do anything.
      The Constructor is called as there are static members and the destructor will be called on unload of the dll.
      I hope that is it. 
      
      
      
    2. login: "azaroo"
    3. mimetype: "text/plain"
    4. username: "azaroo"
  8. Ticket change [9492997e1b] (rid 106009) by ferrieux on 2010-01-13 22:57:02:

    1. icomment:
      OK so you destructor gets called by dlclose(), hence by TclFinalizeLoad, which is very late in the Tcl_Finalize sequence, notably *after* TclFinalizeObjects.
      
      Hence you shouldn't do any Tcl_Obj freeing, nor anything Tcl-oriented for that matter, in the destructor. Just do things that are related to (1) the outside side-effects  of your extensions (created files or shared memory segments mainly), and (2) optionally private mallocs, and only  if you want to use a vlagrind-like tool to hunt leaks. All the rest is guaranteed to be properly nuked by the normal finalization process.
      
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  9. Ticket change [79dae0ce8c] (rid 90202) by ferrieux on 2010-01-13 22:57:03:

    1. closedate changed to: "2010-01-13T15:57:03"
    2. closer changed to: "ferrieux"
    3. resolution changed to: "Invalid"
    4. status changed to: "Closed"