[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-java
Subject:    Re: [Kde-java] Qt bindings hang with gcj
From:       Richard Dale <Richard_Dale () tipitina ! demon ! co ! uk>
Date:       2001-08-22 22:57:05
[Download RAW message or body]

On Wed, 22 Aug 2001, Thomas Kuhn wrote:
> > Signals/slots and event handling both depend on reflection, and it sounds
> > as though it isn't working properly with gcj (see
> > qtjava/javalib/org/kde/qt/Invocation.java for the code). Is there some sort
> > of '--enable-reflection' compile flag? The runtime uses reflection to check
> > whether or not a java instance has an event handler method for the current
> > event. If it finds an event handler it will call it. But gcj thinks there
> > are never any event handlers implemented, and so no events ever get through
> > to the java code.
> I rechecked that this morning, if the events reach java they are handled 
> correctly. The hang occours when calling QtSupport::evevtxxxDelegate or any 
> similar function. When doing a callback from c++ to java using 
> QtSupport::GetEnv sometimes (not always) this hang occours. Usually it works 
> about 20-40 times so I think it's some bug in gjc's jni implementation. I'll 
> try to rewrite the callback parts of QtSupport with cni - as far as I see its 
> the only class that does callbacks from c++ to java - am I correct here ? 
> At least GetEnv isn't called from any other c++ function. Jni seems to be 
> working when the JNIEnv is passed as parameter to the native function so I 
> hope the bindings will work when the callback stuff in QtSupport is cni. I 
> don't think I have to change anything in Invocation.java because when the 
> callback reached the java part everything worked fine.
The env pointer returned by QtSupport::GetEnv(), should be set up correctly as
long as QtSupport::registerJVM() has been called. And that method gets called
via a native method from the static initialization of qtjava.java:

	static {
		System.loadLibrary("qtjava");
		qtjava.registerJVM();
		qtjava.setJavaSlotFactory();
		qtKeyToJavaMap = new WeakValueMap();
		qtSignalDictionary = new HashMap();
		qtSlotDictionary = new HashMap();

	}

The JavaSlot.h/cpp code also calls Invocation.java to invoke a slot.

-- Richard
_______________________________________________
Kde-java mailing list
Kde-java@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-java

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic