com gtk/php-gtk: Modified example: test/bug_callbackexception .php
[email protected] (David Soria Parra) Wed, 15 Mar 2006 21:03:30 +0000
| Newsgroups | php.gtk.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 02521c2ceab08ba4dede20a188834d99bf4f320d Author: Christian Weiske <[email protected]> Wed, 15 Mar 2006 21:03:30 +0000 Parents: 02e424d349ab614625ba074fed5487ed25b650d9 Branches: master Link: http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=02521c2ceab08ba4dede20a188834d99bf4f320d Log: Modified example Changed paths: M test/bug_callbackexception.php Diff: 02521c2ceab08ba4dede20a188834d99bf4f320d diff --git a/test/bug_callbackexception.php b/test/bug_callbackexception.php index d9f12d6..adef6f1 100644 --- a/test/bug_callbackexception.php +++ b/test/bug_callbackexception.php @@ -1,10 +1,27 @@ <?php - +/** +* The exception is not visible in the Gtk::main() loop +* But visible when doing the main_iteration - that's +* because of the while that is a php method. +* +* Change the "if (true)" into "if (false)" to see that +* the exception is thrown in the while loop +*/ function cb() { + echo "Exception will be thrown next line\r\n"; throw new Exception('Will not get displayed anywhere'); } -Gtk::idle_add('cb'); -Gtk::main(); +Gtk::timeout_add(10, 'cb'); + +if (true) { + Gtk::main(); +} else { + sleep(1); + while (Gtk::events_pending()) { + Gtk::main_iteration(); + } +} +echo "done throwing exception\r\n"; ?> \ No newline at end of file