#1037 menu index command changed

obsolete: 8.4a3
closed-works-for-me
Todd Helfter
5
2002-08-08
2001-07-26
No

Under some circumstances, I'm running into:

Tcl_AppendStringsToObj called with shared object

when trying to invoke mnemonics (Alt-<letter>) in a UNIX GUI. I've tracked this down to
tkMenuFind which includes the code:

set last [$child index last]
for {set i [$child cget -tearoff]} {$i <= $last} {incr i} {

It appears that in Tk 8.2, [$m index last] returns 0 for an empty menu. In Tk 8.4, it returns
"none". Whatever the value of -tearoff (0 or 1), it's less than "none" so the loop is executed at
least once. Then in the loop body

set char2 [string index [$child entrycget $i -label] \ [$child entrycget $i -underline]]

Causes the Tcl_AppendStringToObj error noted above.

Discussion

  • Jeffrey Hobbs
    Jeffrey Hobbs
    2001-12-27

    • assigned_to: nobody --> tmh
     
  • Todd Helfter
    Todd Helfter
    2002-02-06

    • status: open --> open-works-for-me
     
  • Todd Helfter
    Todd Helfter
    2002-02-06

    Logged In: YES
    user_id=92123

    when I test this with 8.4a4, an empty menu returns 0 not none.
    are you still getting this error and if so, can you post an
    example?

     
  • Logged In: YES
    user_id=107514

    The problem was hard to reproduce when I originally reported it. I guess this will have to be closed or
    canceled.

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2002-08-08

    Logged In: YES
    user_id=72656

    cannot repeat anymore ... this may have been a transient Tcl
    bug.

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2002-08-08

    • status: open-works-for-me --> closed-works-for-me