Subject: | run vs loop_forever |
I have used the IO::Async::Loop::Glib with a Gtk3 interface.
my $main_loop = Glib::MainLoop->new;
# ... build a Gtk3 window with a button 'quit'
$btnQuit->signal_connect('clicked' => sub {
$main_loop->loop_stop ;
});
# ...
$main_loop->run;
# ---
When the button is pressed, if shows an error message:
*** unhandled exception in callback:
*** Can't call method "quit" on an undefined value at local/lib/perl5/IO/Async/Loop/Glib.pm line 340.
*** ignoring at local/lib/perl5/IO/Async/Loop/Glib.pm line 319.
If I change "run" by "loop_forever", it works properly. I think the "run" method should be overridden to save $self->{mainloop}.