Subject: | fatal error if '.' in Cascade label |
Depending on whether or not `-menuitems' is used to construct a menubar, creating a cascade with a '.' (period/full stop) anywhere in its label can result in a fatal error like the following:
bad window path name ".menu02.m1.import.." at /usr/local/share/perl5/Tcl/pTk/Widget.pm line 332.
at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 121.
Tcl::pTk::Widget::new("Tcl::pTk::Menu", Tcl::pTk::Menu=HASH(0x55660d15fb28), "Name", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 58
Tcl::pTk::Widget::Menu(Tcl::pTk::Menu=HASH(0x55660d15fb28), "Name", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 123
Tcl::pTk::Menu::Cascade::PreInit("Tcl::pTk::Menu::Cascade", Tcl::pTk::Menu=HASH(0x55660d15fb28), HASH(0x55660b93bfa8)) called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 49
Tcl::pTk::Menu::Item::new("Tcl::pTk::Menu::Cascade", Tcl::pTk::Menu=HASH(0x55660d15fb28), "-label", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 58
Tcl::pTk::Menu::Cascade(Tcl::pTk::Menu=HASH(0x55660d15fb28), "-label", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 153
Tcl::pTk::Menu::Cascade::cascade(Tcl::pTk::Menu::Cascade=ARRAY(0x55660d2bfdd8), "-label", "Import...", "-tearoff", "false") called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 479
hsw12_gui::create_main_window(hsw12_gui=HASH(0x55660b33c7b0)) called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 4578
hsw12_gui::build_gui(hsw12_gui=HASH(0x55660b33c7b0)) called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 358
hsw12_gui::new("hsw12_gui", undef) called at ./hsw12.pl line 71
at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 121.
Tcl::pTk::Widget::new("Tcl::pTk::Menu", Tcl::pTk::Menu=HASH(0x55660d15fb28), "Name", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 58
Tcl::pTk::Widget::Menu(Tcl::pTk::Menu=HASH(0x55660d15fb28), "Name", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 123
Tcl::pTk::Menu::Cascade::PreInit("Tcl::pTk::Menu::Cascade", Tcl::pTk::Menu=HASH(0x55660d15fb28), HASH(0x55660b93bfa8)) called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 49
Tcl::pTk::Menu::Item::new("Tcl::pTk::Menu::Cascade", Tcl::pTk::Menu=HASH(0x55660d15fb28), "-label", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/MegaWidget.pm line 58
Tcl::pTk::Menu::Cascade(Tcl::pTk::Menu=HASH(0x55660d15fb28), "-label", "Import...", "-tearoff", "false") called at /usr/local/share/perl5/Tcl/pTk/Menu/Item.pm line 153
Tcl::pTk::Menu::Cascade::cascade(Tcl::pTk::Menu::Cascade=ARRAY(0x55660d2bfdd8), "-label", "Import...", "-tearoff", "false") called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 479
hsw12_gui::create_main_window(hsw12_gui=HASH(0x55660b33c7b0)) called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 4578
hsw12_gui::build_gui(hsw12_gui=HASH(0x55660b33c7b0)) called at /home/osboxes/git/HSW12/Perl/hsw12_gui.pm line 358
hsw12_gui::new("hsw12_gui", undef) called at ./hsw12.pl line 71
The above is from a submenu (not top-level) cascade, and without using `-menuitems`: cf. https://github.com/chrstphrchvz/HSW12/blob/b365652fd3dca59a90854aa3f5e1b1e777f2bb63/Perl/hsw12_gui.pm#L476
This can be reproduced with the widget demo: in the `menus` demo, changing a cascade submenu label (e.g. '~Check buttons' to '~Check buttons...') fails, but works for a top-level cascade (e.g. '~File' to '~File...'). However the opposite is observed by modifying `menus2` similarly; a submenu cascade accepts '.' in the label, but the top-level menu will not.
A workaround is to remove any '.' from the label.