|
|
||||||||||||||||
while ($making_other_plans) { life(); } location('ipsstb', 'perl_programming'); |
For Web Designers | 2021-02-04 02:57:48 UTC | Mail Delivery Problems? |
Sunday, February 03 2013
Curses::UI::Notebook Page Delete Bug, Part Two
Just a while ago I wrote about a bug in Curses::UI::Notebook delete_page. Well, shucks, I found another. This one will puke up the error The notebook already has a page named... whatever previously used and then deleted name you've chosen. This bug manifests itself as widget (page) objects not actually being removed from the UI::Curses::Container object by UI::Curses::Notebook. The page/tab disappears but the object itself hangs around, so if you try to reuse the name your application dies. To duplicate: [ / perl_programming] permanent link Comments: 0 Trackbacks: 0
Curses::UI::Notebook Delete Page Bug
The Problem: Curses::UI::Notebook delete_page() crashes the application. #!/usr/bin/perl use strict; use Curses::UI; my $ui = Curses::UI->new(); my $win = $ui->add('win1', 'Window', -border => 0, -y => 0, -bfg => 'blue', ); my $notebook = $win->add(undef, 'Notebook'); my $p1 = $notebook->add_page('Page 1'); $p1 -> add(undef, 'Label', -x => 1, -y => 1, -text => "This is Page One", ); my $p2 = $notebook->add_page('Page 2'); $p2 -> add(undef, 'Label', -x => 1, -y => 1, -text => "This is Page Two", ); # Now the fun part: $ui->set_timer( 'delete_active_page', sub { $notebook->delete_page($notebook->active_page()); $_[0]->delete_timer('delete_active_page'); }, 5 ); # What we expect to happen is that five seconds into runtime, the # currently active page will disappear. # # What ACTUALLY happens is that the application crashes. $ui->set_binding( sub { $ui->mainloopExit() }, "\cQ" ); $notebook->focus(); $ui->mainloop(); Never mind the use of the undocumented features set_timer() and delete_timer() for now. I'll 'splain 'em momentarily. They're very handy. I'm a source code reading fool but if you haven't seen it yet I'll save you the bother. First, though: [ / perl_programming] permanent link Comments: 0 Trackbacks: 0 |
By Month:
By category:
Feeds: |
Served to 3.237.97.64:51562 at 02:57:48 GMT on Thursday, March 4, 2021.
return(0.5100);