|
2025-04-11
| ||
| 17:04 | • Closed ticket [fd8341e496]: Tcl_InitStubs compatibility for 9.1 plus 6 other... artifact: ddcaa6be68 user: jan.nijtmans | |
| 16:42 | • Ticket [fd8341e496]: 3 changes artifact: cf672f5b1d user: jan.nijtmans | |
| 16:35 | Fix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 check-in: 41c49572f8 user: jan.nijtmans tags: core-9-0-branch | |
| 16:26 | Fix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 check-in: 6c109384fd user: jan.nijtmans tags: core-8-6-branch | |
|
2025-04-10
| ||
| 12:24 | Fix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 closed check-in: 32f67e254a user: jan.nijtmans tags: bug-fd8341e496 | |
| 12:22 | • New ticket [fd8341e496] Tcl_InitStubs compatibility for 9.1. artifact: 8aa5e816f1 user: jan.nijtmans | |
Tcl_InitStubs compatibility for 9.1
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)));
}
}
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:
if (Tcl_InitStubs(interp, "8.x-", 0) == NULL) {
Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
}
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".
41c49572f8Fix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 check-in2025-04-11 16:35:506c109384fdFix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 check-in2025-04-11 16:26:3632f67e254aFix for [fd8341e496]: Tcl_InitStubs compatibility for 9.1 check-in2025-04-10 12:24:51
Fixed [here]