GNOME Bugzilla – Bug 328740
Java-GNOME is not 64-bit clean
Last modified: 2006-01-27 15:21:58 UTC
Steps to reproduce: 1. Run on x86-64 machine Stack trace: (Always building using -Werror -Wmissing-prototype -Wmissing-return will flush out these errors.) dnovillo at redhat writes: I will be sending this patch to LibGlade upstream. The SEGV inside LibGlade was due to a bug in jni/org_gnu_glade_LibGlade.c. The file does not include a prototype for gkt-java's getGObjectHandle, so the compiler was assuming the function returns 'int'. The function actually returns a 'void *', and since this is a 64bit host, the returned value (assumed to be int by the compiler) was being sign extended. So, anyway, the fix is obvious. The warnings were right there and being ignored, as usual. The actual difficult part of finding this was the multithreading and the multitude of calls into JNI, pthread, dynamic casts and the rest of Java's runtime. Sigh. --- src/jni/org_gnu_glade_LibGlade.c 2006/01/26 01:39:30 1.1 +++ src/jni/org_gnu_glade_LibGlade.c 2006/01/26 01:44:26 @@ -18,6 +18,7 @@ #include <glade/glade.h> #include <gtk/gtk.h> #include <jg_jnu.h> +#include <gtk_java.h> #define LIBGLADE_DOMAIN "libglade" @@ -148,7 +149,7 @@ Java_org_gnu_glade_LibGlade_glade_1xml_1 len = (*env)->GetArrayLength(env, buffer); buf = (*env)->GetByteArrayElements(env, buffer, NULL); if (buf == NULL) - return; + return NULL; rootname = root ? (char *)(*env)->GetStringUTFChars(env, root, 0) : NULL; @@ -159,7 +160,7 @@ Java_org_gnu_glade_LibGlade_glade_1xml_1 (*env)->ReleaseByteArrayElements(env, buffer, buf, 0); if ((*env)->ExceptionCheck(env)) - return; + return NULL; //(*env)->SetObjectField(env, o, gladeFID, getHandleFromPointer(env, xml)); return getGObjectHandle(env, (GObject *) xml); @@ -190,7 +191,7 @@ Java_org_gnu_glade_LibGlade_glade_1xml_1 remove_log_handler(handler_id); if ((*env)->ExceptionCheck(env)) - return; + return NULL; //(*env)->SetObjectField(env, o, gladeFID, getHandleFromPointer(env, xml)); return getGObjectHandle(env, (GObject *) xml); Other information:
downstream bug http://sourceware.org/bugzilla/show_bug.cgi?id=2214
Created attachment 58211 [details] [review] modified patch, aplied to HEAD I've committed a slightly modified version of the patch to CVS HEAD. I'll post the modified version for reference.
Closing.