• Why Tcl 9 apps crash?

    From meshparts@[email protected] to comp.lang.tcl on Sun Sep 7 20:56:14 2025
    From Newsgroup: comp.lang.tcl

    I experience a Tcl crash under Windows 11 for almost every simple error.

    A variable is not defined: Crash
    A procedure is not defined: Crash
    A namespace is not defined: Crash

    By "Crash" I mean the program exits, closes.

    Why is this happening?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@[email protected] to comp.lang.tcl on Sun Sep 7 21:17:56 2025
    From Newsgroup: comp.lang.tcl

    Am 07.09.2025 um 20:56 schrieb meshparts:
    I experience a Tcl crash under Windows 11 for almost every simple error.

    A variable is not defined: Crash
    A procedure is not defined: Crash
    A namespace is not defined: Crash

    By "Crash" I mean the program exits, closes.

    Why is this happening?

    I have no such experience. My application only exits on the exit command.

    Sorry,
    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From meshparts@[email protected] to comp.lang.tcl on Mon Sep 8 16:59:30 2025
    From Newsgroup: comp.lang.tcl

    Am 07.09.2025 um 21:17 schrieb Harald Oehlmann:
    Am 07.09.2025 um 20:56 schrieb meshparts:
    I experience a Tcl crash under Windows 11 for almost every simple error.

    A variable is not defined: Crash
    A procedure is not defined: Crash
    A namespace is not defined: Crash

    By "Crash" I mean the program exits, closes.

    Why is this happening?

    I have no such experience. My application only exits on the exit command.

    Sorry,
    Harald

    After long searching, I found out the reason for the crash.
    I have a baground error handler (bgerror) that not only writes the error information to a file but also creates a system notification, as
    supported by Tcl 9.

    This seems to crash the Tcl/Tk app in most of the cases.
    I suppose there are some things that are not allowed in a system
    notification message.

    Here is the last example that causes the crash:

    tk sysnotify Warning {*** START OF ERROR MESSAGE ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
    *** ERROR INFO ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
    while executing
    "lsearch -nocase -start $start $values $value*"
    (procedure "::ttk::combobox::CompleteEntry" line 33)
    invoked from within
    "::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1 "
    (command bound to event)
    *** ERROR STACK ***
    INNER:invokeStk1 lsearch -nocase -start {} {0 16 32 100 150 300} 1* CALL:::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1

    *** END OF ERROR MESSAGE ***}

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ralf Fassel@[email protected] to comp.lang.tcl on Mon Sep 8 19:53:35 2025
    From Newsgroup: comp.lang.tcl

    * meshparts <[email protected]>
    | Here is the last example that causes the crash:

    | tk sysnotify Warning {*** START OF ERROR MESSAGE ***

    https://www.tcl-lang.org/man/tcl9.0/TkCmd/sysnotify.html

    PLATFORM NOTES
    Windows
    The image is taken from the system tray, i.e., sysnotify can only be
    called when a systray was installed.

    I have no idea what a systray is, but did you install one?

    https://www.tcl-lang.org/man/tcl9.0/TkCmd/systray.html

    Agreed, Tk should not crash, but if the invocation of the error handler
    raises an error which calls the error handler which raises an error
    which [repeat ad inf]...

    R'
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@[email protected] to comp.lang.tcl on Mon Sep 8 21:16:57 2025
    From Newsgroup: comp.lang.tcl

    Am 08.09.2025 um 16:59 schrieb meshparts:
    Am 07.09.2025 um 21:17 schrieb Harald Oehlmann:
    Am 07.09.2025 um 20:56 schrieb meshparts:
    I experience a Tcl crash under Windows 11 for almost every simple error. >>>
    A variable is not defined: Crash
    A procedure is not defined: Crash
    A namespace is not defined: Crash

    By "Crash" I mean the program exits, closes.

    Why is this happening?

    I have no such experience. My application only exits on the exit command.

    Sorry,
    Harald

    After long searching, I found out the reason for the crash.
    I have a baground error handler (bgerror) that not only writes the error information to a file but also creates a system notification, as
    supported by Tcl 9.

    This seems to crash the Tcl/Tk app in most of the cases.
    I suppose there are some things that are not allowed in a system notification message.

    Here is the last example that causes the crash:

    tk sysnotify Warning {*** START OF ERROR MESSAGE ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
    *** ERROR INFO ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
        while executing
    "lsearch -nocase -start $start $values $value*"
        (procedure "::ttk::combobox::CompleteEntry" line 33)
        invoked from within
    "::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1 "
        (command bound to event)
    *** ERROR STACK ***
    INNER:invokeStk1

    CALL:::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1

    *** END OF ERROR MESSAGE ***}


    lsearch -nocase -start {} {0 16 32 100 150 300} 1*

    It says: the argument of "-start" may not be the empty string.
    Unfortunately, it is. This is the index reform. See migration notes.

    Take care,
    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From meshparts@[email protected] to comp.lang.tcl on Mon Sep 8 21:52:32 2025
    From Newsgroup: comp.lang.tcl

    Am 08.09.2025 um 19:53 schrieb Ralf Fassel:
    * meshparts <[email protected]>
    | Here is the last example that causes the crash:

    | tk sysnotify Warning {*** START OF ERROR MESSAGE ***

    https://www.tcl-lang.org/man/tcl9.0/TkCmd/sysnotify.html

    PLATFORM NOTES
    Windows
    The image is taken from the system tray, i.e., sysnotify can only be
    called when a systray was installed.

    I have no idea what a systray is, but did you install one?

    https://www.tcl-lang.org/man/tcl9.0/TkCmd/systray.html

    Agreed, Tk should not crash, but if the invocation of the error handler raises an error which calls the error handler which raises an error
    which [repeat ad inf]...

    R'
    System tray is kind of general concept. In Windows it's placed on the
    task bar as a series of icons.

    Tcl 9 introduces for the first time an interface to the system try
    (which is awesome).

    So no, I don't need to install anything, it's standard.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From meshparts@[email protected] to comp.lang.tcl on Mon Sep 8 21:54:38 2025
    From Newsgroup: comp.lang.tcl

    Am 08.09.2025 um 21:16 schrieb Harald Oehlmann:
    Am 08.09.2025 um 16:59 schrieb meshparts:
    Am 07.09.2025 um 21:17 schrieb Harald Oehlmann:
    Am 07.09.2025 um 20:56 schrieb meshparts:
    I experience a Tcl crash under Windows 11 for almost every simple
    error.

    A variable is not defined: Crash
    A procedure is not defined: Crash
    A namespace is not defined: Crash

    By "Crash" I mean the program exits, closes.

    Why is this happening?

    I have no such experience. My application only exits on the exit
    command.

    Sorry,
    Harald

    After long searching, I found out the reason for the crash.
    I have a baground error handler (bgerror) that not only writes the
    error information to a file but also creates a system notification, as
    supported by Tcl 9.

    This seems to crash the Tcl/Tk app in most of the cases.
    I suppose there are some things that are not allowed in a system
    notification message.

    Here is the last example that causes the crash:

    tk sysnotify Warning {*** START OF ERROR MESSAGE ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
    *** ERROR INFO ***
    bad index "": must be integer?[+-]integer? or end?[+-]integer?
         while executing
    "lsearch -nocase -start $start $values $value*"
         (procedure "::ttk::combobox::CompleteEntry" line 33)
         invoked from within
    "::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1 "
         (command bound to event)
    *** ERROR STACK ***
    INNER:invokeStk1

    CALL:::ttk::combobox::CompleteEntry .fkm.sw.sf.mf.cf.f3.e5 1

    *** END OF ERROR MESSAGE ***}


    lsearch -nocase -start {} {0 16 32 100 150 300} 1*

    It says: the argument of "-start" may not be the empty string.
    Unfortunately, it is. This is the index reform. See migration notes.

    Take care,
    Harald

    If I understand you right, you are exlaining the cause of the error, but
    this is not the point here.

    I get an error and by background error handler outputs the error trace.

    The thing is, that Tcl crashes when I write the error trace to the
    system tray. There is something in that message string that causes the
    crash.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From undroidwish@[email protected] to comp.lang.tcl on Mon Sep 8 22:53:26 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/25 21:54, meshparts wrote:


    The thing is, that Tcl crashes when I write the error trace to the
    system tray. There is something in that message string that causes the crash.

    Most likely you found overwritten memory which deserves a ticket in
    the Tk repo. I believe that I have a POC fix here

    https://androwish.org/home/info/09ee4092e874d3a5

    but better let the Tk and Win32 experts work on this problem.

    HTH,
    Christian
    --- Synchronet 3.21a-Linux NewsLink 1.2