Trying to use gij (4.1 SVN - uses classpath 0.18) and AWT qt-peers to show applets in Konqueror 3.5 hits an assert() causing gij to terminate.
Created attachment 10144 [details] Fix Attaching a fix -- not 100% sure this is the right thing to do though (I don't speak Java/JNI well enough to figure out why this is called without a QWidget, but in terms of normal C++ Qt this should get you the application default palette, which is what the patch does...).
You're right. This isn't meant to happen (hence the assert()!). The function in question (getting the native bg color) is one of the QtComponentPeer.setup() calls, all of which are supposed to be performed *after* the widget has been created in the init() method. So the question here is: Why hadn't the init() method created a widget? It'd be quite helpful if you could say which component-peer causes this? (and thus has the failing init()).
Sorry for the delay, bug 24698 prevented me from doing any further testing lately (using the workaround attached to bug 24698 now -- not perfect, but sufficient to tell konqueror to use gij with qt peers again). With this new compiler and the patch attached to this bug, I'm now getting: QFont: It is not safe to use text and fonts outside the gui thread [... repeated over and over ...] java: ../../../../../../../libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp:257: void Java_gnu_java_awt_peer_qt_QtComponentPeer_setGround(JNIEnv*, __jobject*, jint, jint, jint, jboolean): Assertion `widget' failed. I'll add some debug statements to try and figure out what's going on now.
This is weird stuff... I've added some debug info to Java_gnu_java_awt_peer_qt_QtComponentPeer_setGround: JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setGround (JNIEnv *env, jobject obj, jint r, jint g, jint b, jboolean isForeground) { QColor *color = new QColor(r, g, b); QWidget *widget = (QWidget *) getNativeObject( env, obj ); if(!widget) { jclass cls = env->GetObjectClass( obj ); if(!cls) { cerr << "QtComponentPeer_setGround called without object!" << endl; return; } jmethodID method = env->GetMethodID(cls, "getName", "()Ljava/lang/String"); jstring name = (jstring) env->CallObjectMethod(cls, method); char const *n=env->GetStringUTFChars(name, 0); cerr << "QtComponentPeer_setGround called on a " << n << endl; env->ReleaseStringUTFChars(name, n); return; } mainThread->postEventToMain( new AWTBackgroundEvent(widget, (isForeground == JNI_TRUE), color) ); } This results in "QtComponentPeer_setGround called on a "
Created attachment 12018 [details] Small test case triggering the problem I've finally managed to create a smaller test case than Konqueror that hits the assertion -- seems to be in some way related to java Canvas-es. Running the test case results in: QFont: It is not safe to use text and fonts outside the GUI thread [repeated numerous times] java: ../../../../../../../libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp:257: void Java_gnu_java_awt_peer_qt_QtComponentPeer_setGround(JNIEnv*, __jobject*, jint, jint, jint, jboolean): Assertion `widget' failed. Aborted