[Java-gnome-developer] Freezing on runtime exception within signal handler
Brought to you by:
afcowie
From: Julian F. <jfi...@ho...> - 2001-03-24 06:57:51
|
When a runtime exception (such as a NullPointerException) gets thrown from within a handler method, the entire Gtk main loop freezes. This patch corrects the problem. The only thing is it seems like the exception may not be getting re-thrown like it ought to be... the program no longer freezes but the main loop doesn't exit with an exception either. Anyway, it's one step up from where it was: Julian Index: src/other/callback_dispatcher.c =================================================================== RCS file: /cvsroot/java-gnome/java-gnome/src/other/callback_dispatcher.c,v retrieving revision 1.14 diff -u -r1.14 callback_dispatcher.c --- src/other/callback_dispatcher.c 2001/03/15 12:34:24 1.14 +++ src/other/callback_dispatcher.c 2001/03/24 06:57:10 @@ -118,6 +118,7 @@ jobject globalObj; jlong peer; jfieldID peerfid; + jthrowable exc; jargs = alloca(n_args+1 * sizeof(jvalue)); @@ -251,6 +252,12 @@ default: printf("*** ERROR ***: Return type %d NYI", args[n_args].type); break; + } + + exc = (* cbi->env)->ExceptionOccurred(cbi->env); + if (exc) { + (* cbi->env)->Throw(cbi->env, exc); + (* cbi->env)->ExceptionClear(cbi->env); } } |