cvs: php-gtk /test bug_callbackexception.php

From: Date: Wed, 15 Mar 2006 21:03:30 +0000
Subject: cvs: php-gtk /test bug_callbackexception.php
Groups: php.gtk.cvs 
Request: Send a blank email to php-gtk-cvs+get-2190@lists.php.net to get a copy of this message
cweiske Wed Mar 15 21:03:30 2006 UTC Modified files: /php-gtk/test bug_callbackexception.php Log: Modified example http://cvs.php.net/viewcvs.cgi/php-gtk/test/bug_callbackexception.php?r1=1.1&r2=1.2&diff_format=u Index: php-gtk/test/bug_callbackexception.php diff -u php-gtk/test/bug_callbackexception.php:1.1 php-gtk/test/bug_callbackexception.php:1.2 --- php-gtk/test/bug_callbackexception.php:1.1 Wed Mar 15 19:31:33 2006 +++ php-gtk/test/bug_callbackexception.php Wed Mar 15 21:03:30 2006 @@ -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

« previous php.gtk.cvs (#2190) next »