Hi,

This makes sure that when anything goes wrong initializing GdkGraphics2D
(like when you didn't configure with --enable-gtk-cairo) an exception is
thrown instead of the code crashing. Found by Dalibor and me during
DevJam.

2005-09-30  Mark Wielaard  <[EMAIL PROTECTED]>

    * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
    (cp_gtk_graphics2d_init_jni): Check ExceptionOccured after running
    class initializer.

Committed,

Mark
Index: libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.18
diff -u -r1.18 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	19 Aug 2005 01:27:51 -0000	1.18
+++ libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	26 Sep 2005 18:44:41 -0000
@@ -58,9 +58,12 @@
 cp_gtk_graphics2d_init_jni (void)
 {
   jclass gdkgraphics2d;
+  JNIEnv *env = cp_gtk_gdk_env();
 
-  gdkgraphics2d = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
-                                           "gnu/java/awt/peer/gtk/GdkGraphics2D");
+  gdkgraphics2d = (*env)->FindClass (env,
+				     "gnu/java/awt/peer/gtk/GdkGraphics2D");
+  if ((*env)->ExceptionOccurred(env))
+    return;
 
   initComponentGraphics2DUnlockedID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
                                                          "initComponentGraphics2DUnlocked",

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to