[cairo-commit]
cairo-java/src/jni org_freedesktop_cairo_Cairo.c, 1.9,
1.10 org_freedesktop_cairo_TextExtents.c, 1.1, 1.2
Jeffrey Morgan
commit at pdx.freedesktop.org
Mon Mar 14 08:24:08 PST 2005
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv705/src/jni
Modified Files:
org_freedesktop_cairo_Cairo.c
org_freedesktop_cairo_TextExtents.c
Log Message:
Fixed allocation of TextExtents and free memory.
Index: org_freedesktop_cairo_Cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Cairo.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- org_freedesktop_cairo_Cairo.c 13 Mar 2005 16:36:58 -0000 1.9
+++ org_freedesktop_cairo_Cairo.c 14 Mar 2005 16:24:06 -0000 1.10
@@ -775,12 +775,16 @@
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Cairo_cairo_1text_1extents
(JNIEnv *env, jclass cls, jobject obj, jstring text, jobject extents)
{
- cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
- const unsigned char *text_g = (const unsigned char*)(*env)->GetStringUTFChars(env, text, NULL);
- cairo_text_extents_t extents_g;
- cairo_text_extents(cr, text_g, &extents_g);
+ cairo_t *cr;
+ cairo_text_extents_t *extents_g;
+ const unsigned char *text_g =
+ (const unsigned char*)(*env)->GetStringUTFChars(env, text, NULL);
+
+ cr = (cairo_t*)getPointerFromHandle(env, obj);
+ extents_g = g_new(cairo_text_extents_t, 1);
+ cairo_text_extents(cr, text_g, extents_g);
(*env)->ReleaseStringUTFChars(env, text, text_g);
- updateHandle(env, extents, &extents_g);
+ updateHandle(env, extents, extents_g);
}
/*
Index: org_freedesktop_cairo_TextExtents.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_TextExtents.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- org_freedesktop_cairo_TextExtents.c 23 Feb 2005 18:17:52 -0000 1.1
+++ org_freedesktop_cairo_TextExtents.c 14 Mar 2005 16:24:06 -0000 1.2
@@ -89,6 +89,21 @@
return te->y_advance;
}
+/*
+ * Class: org_freedesktop_cairo_TextExtents
+ * Method: free
+ * Signature: (Lorg/gnu/glib/Handle;)V
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_TextExtents_free
+ (JNIEnv *env, jclass cls, jobject obj)
+{
+ cairo_text_extents_t *te;
+
+ te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
+ g_free(te);
+}
+
+
#ifdef __cplusplus
}
#endif
More information about the cairo-commit
mailing list