After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 328740 - Java-GNOME is not 64-bit clean
Java-GNOME is not 64-bit clean
Status: RESOLVED FIXED
Product: java-gnome
Classification: Bindings
Component: LibGlade
mainline
Other All
: Normal critical
: ---
Assigned To: Igor Foox
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-26 17:29 UTC by Andrew Cagney
Modified: 2006-01-27 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
modified patch, aplied to HEAD (1.31 KB, patch)
2006-01-27 15:21 UTC, Igor Foox
none Details | Review

Description Andrew Cagney 2006-01-26 17:29:15 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:
Comment 1 Andrew Cagney 2006-01-26 17:42:50 UTC
downstream bug http://sourceware.org/bugzilla/show_bug.cgi?id=2214
Comment 2 Igor Foox 2006-01-27 15:21:29 UTC
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.
Comment 3 Igor Foox 2006-01-27 15:21:58 UTC
Closing.