classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Check ExceptionOccured when initializing GdkGraphics2D


From: Mark Wielaard
Subject: [cp-patches] FYI: Check ExceptionOccured when initializing GdkGraphics2D
Date: Fri, 30 Sep 2005 12:07:23 +0200

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  <address@hidden>

    * 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


reply via email to

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