gnu_java_awt_peer_gtk_GdkPixbufDecoder.c: use DeleteLocalRef() to avoid exhausting local native references.

2005-05-06  Archie Cobbs  <archie@dellroad.org>

	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c:
	use DeleteLocalRef() to avoid exhausting local native references.

From-SVN: r99302
This commit is contained in:
Archie Cobbs 2005-05-06 06:10:18 +00:00 committed by Michael Koch
parent 9b8d7b4252
commit 8108f99852
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2005-05-06 Archie Cobbs <archie@dellroad.org>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c:
use DeleteLocalRef() to avoid exhausting local native references.
2005-05-06 Mark Wielaard <mark@klomp.org>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:

View File

@ -206,6 +206,7 @@ query_formats (JNIEnv *env, jclass clazz)
jclass formatClass;
jmethodID addExtensionID;
jmethodID addMimeTypeID;
jobject string;
formatClass = (*env)->FindClass
(env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec");
@ -227,26 +228,33 @@ query_formats (JNIEnv *env, jclass clazz)
format = (GdkPixbufFormat *) f->data;
name = gdk_pixbuf_format_get_name(format);
string = (*env)->NewStringUTF(env, name);
g_assert(string != NULL);
jformat = (*env)->CallStaticObjectMethod
(env, clazz, registerFormatID,
(*env)->NewStringUTF(env, name),
(env, clazz, registerFormatID, string,
(jboolean) gdk_pixbuf_format_is_writable(format));
(*env)->DeleteLocalRef(env, string);
g_assert(jformat != NULL);
ch = gdk_pixbuf_format_get_extensions(format);
while (*ch)
{
(*env)->CallVoidMethod (env, jformat, addExtensionID,
(*env)->NewStringUTF(env, *ch));
string = (*env)->NewStringUTF(env, *ch);
g_assert(string != NULL);
(*env)->CallVoidMethod (env, jformat, addExtensionID, string);
(*env)->DeleteLocalRef(env, string);
++ch;
}
ch = gdk_pixbuf_format_get_mime_types(format);
while (*ch)
{
(*env)->CallVoidMethod (env, jformat, addMimeTypeID,
(*env)->NewStringUTF(env, *ch));
string = (*env)->NewStringUTF(env, *ch);
g_assert(string != NULL);
(*env)->CallVoidMethod (env, jformat, addMimeTypeID, string);
(*env)->DeleteLocalRef(env, string);
++ch;
}
}