Skip to content
Tcl Source Code History Of Ticket 3062331fffffffff
Login

History Of Ticket 3062331fffffffff

Artifacts Associated With Ticket 3062331fffffffff

  1. Ticket change [63f2216db6] (rid 92670) by pcmacdon on 2010-09-09 02:22:01:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The script below crashes wish 8.5.9 and 8.5.8 (on Linux).  
      
      # Crash script
      pack [ttk::button .b -textvariable Y]
      trace variable Y u "destroy .b"
      unset Y
      
      
    4. foundin initialized to: "obsolete: 8.5.9"
    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: "pcmacdon"
    10. subsystem initialized to: "07. Variables"
    11. title initialized to: "segfault in var traces with ttk::button"
    12. type initialized to: "RFE"
  2. Ticket change [d83348b4b2] (rid 107398) by pcmacdon on 2010-09-09 09:27:09:

    1. icomment:
      Possibly related is ID: 2629338
      
      Note, this may be due to the fact the handler is trying to remove
      the trace thats to be called next.
      
      
      
    2. login: "pcmacdon"
    3. mimetype: "text/plain"
    4. username: "pcmacdon"
  3. Ticket change [0c45b2a7c5] (rid 114145) by dgp on 2010-10-04 22:56:34:

    1. assignee changed to: "dgp"
    2. priority changed to: "9 Immediate"
    3. subsystem changed to: "46. Traces"
  4. Ticket change [af4af01f5a] (rid 97785) by dgp on 2010-10-12 23:53:24:

    1. icomment:
      Program received signal SIGSEGV, Segmentation fault.
      0x08223505 in Tcl_GetString (objPtr=0x83c8578)
          at /home/dgp/cvs/tcl-only/generic/tclObj.c:1625
      1625        if (objPtr->typePtr->updateStringProc == NULL) {
      (gdb) up
      #1  0x080eeb9a in VarTraceProc (clientData=0x844eae8, interp=0x82e6768,
          name1=0x8454420 "Y", name2=0x0, flags=192)
          at /home/dgp/cvs/tk/unix/../generic/ttk/ttkTrace.c:42
      42          name = Tcl_GetString(tracePtr->varnameObj);
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [d6704b6b58] (rid 123806) by dgp on 2010-10-12 23:57:00:

    1. icomment:
      suggests an invalid state in tracePtr->varNameObj
      where both objPtr->bytes == NULL and objPtr->typePtr == NULL.
      
      Something somewhere is not following the rules.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [82d30b5dd8] (rid 117294) by dgp on 2010-10-13 00:00:14:

    1. assignee changed to: "jenglish"
    2. icomment:
      That points the finger of blame at
      ttkTrace.c in Tk.  I'll leave this item open
      for now in case we can close it quickly.
      If not, we should re-open in the Tk tracker.
      
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  7. Ticket change [dd9af63d93] (rid 114701) by dgp on 2010-10-13 01:08:14:

    1. icomment:
      Possibly a flaw still in Tcl_UntraceVar2() as well.
      
      The call to Tcl_UnsetVar2() is bailing out based on
      the flags set in the variable before it gets to the
      code that scans the activeVarPtr chain for presence
      of the trace that's getting unset.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [2173951573] (rid 130583) by jenglish on 2010-10-13 01:19:34:

    1. icomment:
      Quick diagnosis indicates that this is the same problem as #2629338 -- the trace machinery is calling a VarTraceProc after it has been removed.
      
      Not sure what to do about this.
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  9. Ticket change [8d47bf9edf] (rid 127902) by dgp on 2010-10-13 01:26:20:

    1. icomment:
      I wanted to blame var reform for this, but
      the same test case also crashes Tcl/Tk 8.5a6
      in what appears to be the same way.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [876301455c] (rid 131686) by dgp on 2010-10-13 02:08:27:

    1. icomment:
      
      A lawyer could probably make a case
      that things are behaving "as documented"
      in the ACCESSING VARIABLE DURING TRACES
      section.
      
      During an unset operation, when unset traces
      fire, they see the variable (and all traces attached
      to it) as already gone.  This means that those
      bits of code trying valiantly to tidy up by removing
      those unset traces that are no longer valid get
      turned into no-ops.  Then they cannot remove
      these invalid trace routines before the unset
      operations launches them anyway and they
      crash.
      
      "As documented", true, but that just means
      we've documented a system that's completely
      unworkable.
      
      le sigh.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  11. Ticket change [4d11e1d8aa] (rid 127001) by dgp on 2010-10-13 02:08:28:

    1. assignee changed to: "dgp"
  12. Ticket change [da6ba2d24b] (rid 107781) by dgp on 2010-10-13 21:46:07:

    1. icomment:
      so, two perspectives on what's wrong here.
      
      1) Tcl_UntraceVar() can be a no-op.  Code that
           doesn't account for that can run into this trouble,
          but accounting for that is at best inconvenient, and
          possibly unworkably difficult.
      
      2) Once an [unset] operations gets started, its set of
          unset traces is locked in place.  You can't get rid
          of any of them, even if you know they will crash
          when run.
      
      Two ways of describing the same inherent brokenness
      in the unset trace model.
      
      :P
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  13. Ticket change [b612619dfb] (rid 125360) by dgp on 2011-06-15 01:38:32:

    1. closedate changed to: "2011-06-14T18:38:32"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      Fixed for Ttk 8.5.10 +
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"
  14. Ticket change [6f57840f9e] (rid 100301) by jenglish on 2011-06-15 03:13:57:

    1. icomment:
      Note that the attempted fix (fossil commit ca3d9b7274) -- zero out tracePtr->varnameObj in Ttk_UntraceVariable() and test it in the trace callback -- is not completely correct, since tracePtr itself is freed (this will probably crash in a TCL_MEM_DEBUG build for example).
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  15. Ticket change [92b005ee0d] (rid 120812) by jenglish on 2011-06-15 05:20:35:

    1. icomment:
      I don't think the second fix (fossil e9e6f67c5b) fixes it either (check under valgrind) -- calling Tcl_Preserve()/Tcl_Release() in VarTraceProc() is too late, since tracePtr (VarTraceProc's clientData) has already been EventuallyFree()d by the time it gets there.
      
      Timeline is:
      script-level unset trace calls [destroy .b]
      .b's cleanup code calls Ttk_UntraceVariable, which frees the trace handle and (attempts to) remove the trace hook;
      trace hook gets called anyway, accessing freed memory.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  16. Ticket change [60d0f24ee7] (rid 92137) by jenglish on 2011-06-15 05:20:36:

    1. icomment:
      
      
      allow_comments - 0
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  17. Ticket change [2527fa544d] (rid 131238) by dgp on 2011-06-16 01:19:23:

    1. icomment:
      Reverting failed patches.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. resolution changed to: "None"
    5. status changed to: "Open"
    6. username: "dgp"
  18. Ticket change [be27127841] (rid 102026) by dgp on 2011-06-17 01:30:48:

    1. icomment:
      
      Here's a related demo of the problem,
      using only the (testing) commands of Tcl,
      leaving out the Tk complication:
      
      testlink create {*}[lrepeat 14 1]
      trace add variable int unset {testlink delete; #}
      unset int
      
      This does not crash, but it does leave the
      variable "int" linked to its C counterpart
      while all the other special variables of
      the [testlink] command properly have their
      links broken by [testlink delete].
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  19. Ticket change [fecc27a47f] (rid 108648) by dgp on 2011-06-17 03:28:43:

    1. icomment:
      
      See new Tk branch bug-3062331 for a new
      attempt to fix this in Ttk.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  20. Ticket change [7812581380] (rid 89886) by jenglish on 2011-06-17 06:38:16:

    1. icomment:
      Looks like [e1302383c5] ought to do the trick. 
      
      (My only suggestion would be to add a note mentioning this bug #, to explain why the extra machinery bypassing Tcl_UntraceVar is necessary.)
      
      (Also also: the comment in Tcl_UntraceVar2() claiming that "The code below makes it possible to delete traces while traces are active" perhaps ought to be amended, lest others fall into the same trap I did of believing what it says...)
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  21. Ticket change [ad11403c7a] (rid 101406) by dgp on 2011-06-18 01:44:27:

    1. icomment:
      
      
      data_type - 360894
      
      Converting this to a lower prio feature request.
      I'd like to think a saner trace design is possible
      whenever the time comes we can more seriously
      consider such a thing.  May be wishful thinking.
      History shows that deletes, destructors and the
      like are devilishly tricky.  May be no "right" design
      to achieve.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  22. Ticket change [23df240ccc] (rid 131007) by dgp on 2011-06-18 01:44:28:

    1. foundin changed to: "None"
    2. priority changed to: "5 Medium"
    3. subsystem changed to: "46. Traces"
  23. Ticket change [6f9fc8a6d2] (rid 100344) by jenglish on 2011-10-24 23:44:42:

    1. icomment:
      See also #3425285.  Initial fix (2011-06-17) introduced another bug, now fixed (2011-06-29).  Unfortunately the buggy version made it into Tk release 8.5.10.
      
      See http://core.tcl.tk/tk/info/b938e2364a for the final fix.
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. title changed to: "segfault in variable traces with ttk::* widgets"
    5. username: "jenglish"
  24. Ticket change [d2abb1ae06] (rid 140199) by dgp on 2014-10-09 14:13:53:

    1. closedate changed to: "2456940.09297679"
    2. comment changed to:
      The script below crashes wish 8.5.9 and 8.5.8 (on Linux).  
      
      # Crash script
      pack [ttk::button .b -textvariable Y]
      trace variable Y u "destroy .b"
      unset Y
      
    3. icomment: "Appears this was finished long ago."
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. severity changed to: "Minor"
    8. status changed to: "Closed"