[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_Cairo.c, 1.8, 1.9

Jeffrey Morgan commit at pdx.freedesktop.org
Sun Mar 13 08:37:00 PST 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv2477/src/jni

Modified Files:
	org_freedesktop_cairo_Cairo.c 
Log Message:
completed currentPath and added new status

Index: org_freedesktop_cairo_Cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Cairo.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- org_freedesktop_cairo_Cairo.c	10 Mar 2005 19:38:33 -0000	1.8
+++ org_freedesktop_cairo_Cairo.c	13 Mar 2005 16:36:58 -0000	1.9
@@ -1174,15 +1174,37 @@
 
 	cbdata->move_to = 
 		(*env)->GetMethodID(env, cls, "move_to", "(DD)V");
+    if (cbdata->move_to == NULL ) {
+        g_free(cbdata);
+        // Error!  Throw exception!
+        return NULL;
+    }
 
 	cbdata->line_to = 
 		(*env)->GetMethodID(env, cls, "line_to", "(DD)V");
+    if (cbdata->line_to == NULL ) {
+        g_free(cbdata);
+        // Error!  Throw exception!
+        return NULL;
+    }
 
 	cbdata->curve_to = 
 		(*env)->GetMethodID(env, cls, "curve_to", "(DDDDDD)V");
+    if (cbdata->curve_to == NULL ) {
+        g_free(cbdata);
+        // Error!  Throw exception!
+        return NULL;
+    }
 
 	cbdata->close_path = 
 		(*env)->GetMethodID(env, cls, "close_path", "()V");
+    if (cbdata->close_path == NULL ) {
+        g_free(cbdata);
+        // Error!  Throw exception!
+        return NULL;
+    }
+    
+    return cbdata;
 }
 
 void move_to_callback(void *data, double x, double y)
@@ -1190,13 +1212,10 @@
 	CairoCallback* cbdata = data;
 	jthrowable exc;
 
-	printf("in move_to\n");	
-	printf("calling method\n");
 	(*cbdata->env)->CallVoidMethod(cbdata->env, 
 				       cbdata->obj, 
 				       cbdata->move_to,
 				       x, y); 
-	printf("called method\n");
 	if (exc) {
 		/* Print stack trace */
 		(* cbdata->env)->ExceptionDescribe(cbdata->env);
@@ -1269,6 +1288,8 @@
 {
 	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
 	CairoCallback *cbdata = callback_data(env, cls, cb);
+	if (cbdata == NULL)
+		return;
 	cairo_get_path(cr, move_to_callback, line_to_callback,
 			curve_to_callback, close_path_callback, cbdata);	
 }
@@ -1283,6 +1304,8 @@
 {
 	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
 	CairoCallback *cbdata = callback_data(env, cls, cb);
+	if (cbdata == NULL)
+		return;
 	cairo_get_path_flat(cr, move_to_callback, line_to_callback,
 			close_path_callback, cbdata);
 }




More information about the cairo-commit mailing list