Artifacts Associated With Ticket d402ffe76f
Ticket change [e2eaec4a73] (rid 183229) by chw on 2020-05-10 20:13:51:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
According to MSDN the _wenviron variable initially is NULL when the program starts via main() but is populated on the very first call of _wgetenv() or _wputenv(). The current core-8-6-branch requires in TclSetupEnv() _wenviron to be non NULL, otherwise a crash (access violation, segfault) happens. When some custom code embeds Tcl as a library and uses main() instead of wmain() as its program entry point, that crash is most likely. Please see https://www.androwish.org/home/info/93ee54fe8cd2e176 for a possible solution.
- foundin initialized to: "core-8-6-branch"
- is_private initialized to: "0"
- login: "chw"
- priority initialized to: "5 Medium"
- private_contact initialized to: "0b3aff16612e1e9f3b675963fa64e01bd1d89307"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "chw"
- subsystem initialized to: "50. Embedding Support"
- title initialized to: "Win32 potential crash when using main()"
- type initialized to: "Bug"
Ticket change [a024f310b9] (rid 183239) by jan.nijtmans on 2020-05-10 20:58:59:
- assignee changed to: "jan.nijtmans"
- icomment: "Thanks! I will have a look at this."
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [135b0ca767] (rid 183303) by jan.nijtmans on 2020-05-12 11:29:13:
- closedate changed to: "2458981.97863103"
- closer changed to: "jan.nijtmans"
- icomment:
Merged to core-8-6-branch and up. Thanks for the report and the fix!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [11c618ba05] (rid 261382) by anonymous on 2026-11-10 18:10:43:
- closedate changed to: "2461355.2574499655"
- closer changed to: "anonymous"
- icomment:
This issue still exists in 9.0 due to TclFinalizeIOSubsystem() calling TclGetEnv() around line 598 of tclIO.c. It's possible for trivial apps to initialise and finalise and hit this path. I encountered this creating a minimal repro for a build issue with CPython. The fix I'd suggest is to have TclpFindVariable (in tclWinInit.c) check for a NULL _wenviron and do an arbitrary _wgetenv to initialise before continuing. I assume there's some reason for doing your own search rather than using _wgetenv (or _wgetenv_s), but if not, switching to that for the search ought to be fine too.
- login: "anonymous"
- mimetype: "text/plain"
- username: "[email protected]"
Ticket change [e3a1b985c9] (rid 261383) by oehhar on 2026-11-10 19:27:25:
- closer changed to: "nobody"
- login: "oehhar"
- mimetype: "text/plain"
- status changed to: "Open"
Ticket change [23a9e91ee1] (rid 261387) by jan.nijtmans on 2026-11-10 20:02:21:
- icomment: "Something like [6019bf7e078|this]?"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [7a12b7ef81] (rid 261418) by jan.nijtmans on 2026-11-11 13:56:12:
- closedate changed to: "2461356.0807035416"
- closer changed to: "jan.nijtmans"
- icomment:
No merged to [6019bf7e078|trunk], core-9-0-branch and core-8-6-branch
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"
Ticket change [cd4075d4e3] (rid 261419) by jan.nijtmans on 2026-11-11 14:10:58:
- closedate changed to: "2461356.0909512038"
- icomment:
Now merged to [trunk], core-9-0-branch and core-8-6-branch
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"