[Java-gnome-developer] CVS: Problem with gdk_BaseObject.c and GTK_IS_OBJECT()
Brought to you by:
afcowie
|
From: Santeri P. <sa...@ik...> - 2001-10-09 17:18:21
|
In CVS version, in other/gdk_BaseObject.c:
jobject makeBaseObjectSubclass (JNIEnv *env, jclass cls, void *peer)
{
if (peer == NULL)
return NULL;
else if (GTK_IS_OBJECT(peer))
return makeBaseObjectClass(env, peer);
else {
jobject result = (*env)->AllocObject (env, cls);
jlong result_jl;
*(void **) &result_jl = peer;
(*env)->SetLongField (env, result, nativepeerFid, result_jl);
return result;
}
}
The GTK_IS_OBJECT is a problem, if you try to create any object not based
on Gtk, like GdkGC:
xx = new GdkGC(yy);
leads to:
Program received signal SIGSEGV, Segmentation fault.
0x41383ed6 in makeBaseObjectSubclass (env=0x400887d4, cls=0x6,
peer=0x81244f8)
at other/gdk_BaseObject.c:70
70 else if (GTK_IS_OBJECT(peer))
This, of course happens because "peer" in this context is not a Gtk
object, but instead a GdkWindow, which isn't representable in the Gtk
object system:
(gdb) p *(GdkGC*)peer
$14 = {dummy_var = 1701080693}
(gdb) p *((GtkObject*)peer)
$15 = {klass = 0x65646e75, flags = 135415064, ref_count = 135220712,
object_data = 0x1}
(gdb) p *((GtkObject*)peer)->klass
Cannot access memory at address 0x65646e75
In noticed the GTK_IS_OBJECT was added in version 1.5 (of that file).
Apparently this hasn't been noticed since the test and sample programs
don't use GdkGC directly at all..
--
sa...@ik... I have become death, destroyer of the worlds.
|