|
From: gnome-perl (bugzilla.gnome.org) <bug...@bu...> - 2009-01-13 23:03:30
|
If you have any questions why you received this email, please see the text at the end of this email. Replies to this email are NOT read, please see the text at the end of this email. You can add comments to this bug at: http://bugzilla.gnome.org/show_bug.cgi?id=567659 gnome-perl | Gtk2 | Ver: unspecified Summary: key snooper trap to exception handlers Product: gnome-perl Version: unspecified Platform: Other OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: Gtk2 AssignedTo: gtk...@li... ReportedBy: us...@zi... QAContact: gtk...@li... GNOME version: Unspecified GNOME milestone: Unspecified The key snooper functions installed by Gtk2->key_snooper_install could helpfully trap errors through the Glib->install_exception_handler funcs. The program below shows how an error in a snooper terminates the whole program. (A snooper of course is basically an event handler like widget event handlers, but encompassing all widgets, and on that basis will almost certainly want to continue the main loop.) use strict; use warnings; use Gtk2 '-init'; Glib->install_exception_handler (sub { print "exception trapped\n"; return 1; }); Gtk2->key_snooper_install (sub { print "key snooper runs\n"; die "now throw an error"; }); my $toplevel = Gtk2::Window->new ('toplevel'); $toplevel->add (Gtk2::Label->new('Press any key')); $toplevel->show_all; Gtk2->main; -- See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received this email, why you can't respond via email, how to stop receiving emails (or reduce the number you receive), and how to contact someone if you are having problems with the system. You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=567659. |