gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/jni GzzGL-jni.cxx


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx/jni GzzGL-jni.cxx
Date: Thu, 16 Jan 2003 07:54:25 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/01/16 07:54:24

Modified files:
        gfx/jni        : GzzGL-jni.cxx 

Log message:
        Fix exceptions

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.76&tr2=1.77&r1=text&r2=text

Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.76 gzz/gfx/jni/GzzGL-jni.cxx:1.77
--- gzz/gfx/jni/GzzGL-jni.cxx:1.76      Thu Jan 16 06:24:36 2003
+++ gzz/gfx/jni/GzzGL-jni.cxx   Thu Jan 16 07:54:24 2003
@@ -136,6 +136,16 @@
     DBG(dbg) << "Release current "<<wid<<"\n";
 }
 
+/** If an exception occurred, print a debug message for it and clear it.
+*/
+void javaExc(JNIEnv *env, const char *where) {
+    if(env->ExceptionOccurred()) {
+       cerr << "Exception in "<<where<<"\n";
+         env->ExceptionDescribe();
+         env->ExceptionClear();
+    }
+}
+
 struct GZZJNIEventHandler : public Os::Eventhandler {
 
     jobject globalRef;
@@ -168,11 +178,7 @@
     void repaint() {
        DBG(dbg_event) << "CALLING REPAINT!!!\n";
        jnienv_eventloop->CallVoidMethod(globalRef, mid_repaint);
-
-       if(jnienv_eventloop->ExceptionOccurred()) {
-           cerr << "Java exception in event handler!\n";
-           throw JavaException();
-       }
+       javaExc(jnienv_eventloop, "repaint");
 
        // jnienv_eventloop->DeleteLocalRef(cls);
 
@@ -184,6 +190,7 @@
        DBG(dbg_event) << "Keystroke has been sent\n";
 
        jnienv_eventloop->CallVoidMethod(globalRef, mid_keystroke, jstr);
+       javaExc(jnienv_eventloop, "keystroke");
 
        DBG(dbg_event) << "Call finished\n";
     }
@@ -191,12 +198,15 @@
     virtual void mouse(int x, int y, int button, int type) {
 
         jnienv_eventloop->CallVoidMethod(globalRef, mid_mousepress, x, y, 
button, type);
+       javaExc(jnienv_eventloop, "mouse");
     }
     virtual void timeout(int id) {
         jnienv_eventloop->CallVoidMethod(globalRef, mid_timeout, id);
+       javaExc(jnienv_eventloop, "timeout");
     }
     virtual void windowClosed() {
         jnienv_eventloop->CallVoidMethod(globalRef, mid_windowClosed);
+       javaExc(jnienv_eventloop, "windowClosed");
     }
 };
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]