Skip to content
Tcl Source Code History Of Ticket fd8341e496
Login

History Of Ticket fd8341e496

Artifacts Associated With Ticket fd8341e496

  1. Ticket change [8aa5e816f1] (rid 238960) by jan.nijtmans on 2025-04-10 12:22:13:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      In order to work for all releases, Tk contains code like this:
      <pre>
          if (Tcl_InitStubs(interp, "8.x-", 0) == NULL) {
              if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
                  abort();
              } else {
                  Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
              }
          }
      </pre>
      
      The reason for this complication is because Tcl 8.x and 9.0 store the interp result in a different way: Tcl 8.x used the interp->result field, while Tcl 9.0
      use interp->resultObj(). If the first Tcl_InitStubs() call fails, the stub-table is not initialized, so the Tcl_Panic() line won't work. The best we can do is abort. However, the second Tcl_InitStubs() call resets the interp result, so the Tcl_Panic() works but just gives an empty message.
      
      What would be better is to rewrite the code like this:
      <pre>
          if (Tcl_InitStubs(interp, "8.x-", 0) == NULL) {
              Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
          }
      </pre>
      That won't work, because Tcl_InitStubs() doesn't initialize the stub table after a failure.
      
      Proposed solution: When the version check fails, at least initialize tclStubsPtr for the public API. Then the Tcl_Panic() works.
      
      Why no-one noticed that? Normally Tk and Tcl releases match, so no-one links a Tk version with a different Tcl version. That's the only situation this error goes off. I tested this by changing Tk 9.0 to check for "9.1".
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "jan.nijtmans"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0c50e5320704d174412e57b873d8932de15303e0"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "jan.nijtmans"
    14. subsystem initialized to: "52. Portability Support"
    15. title initialized to: "Tcl_InitStubs compatibility for 9.1"
    16. type initialized to: "Bug"
  2. Ticket change [cf672f5b1d] (rid 239009) by jan.nijtmans on 2025-04-11 16:42:13:

    1. icomment: "Fixed [41c49572f8904ebf|here]"
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [ddcaa6be68] (rid 239010) by jan.nijtmans on 2025-04-11 17:04:46:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2460777.21165113"
    3. closer changed to: "jan.nijtmans"
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"