I've create a VERY simply AWT app (in fact I copied it from somewhere, as I'm
not really a Java coder)
-------------------------------------------
import java.awt.*;
public class HelloWorld extends Frame {
private static final long serialVersionUID = 1234561155622776147L;
public HelloWorld() {
super("HelloWorld Title");
setSize(200, 200);
add(new Label("Application Template...",
Label.CENTER),
BorderLayout.CENTER);
}
public static void main(String[] args) {
HelloWorld app = new HelloWorld();
app.setVisible(true);
}
}
-------------------------------------------
Now I start this little thingy:
-------------------------------------------
# jamvm -Dawt.toolkit=gnu.java.awt.peer.qt.QtToolkit -Dqtoptions.qws=true
HelloWorld
QFont: It is not safe to use text and fonts outside the gui thread
QFont: It is not safe to use text and fonts outside the gui thread
QFont: It is not safe to use text and fonts outside the gui thread
QFont: It is not safe to use text and fonts outside the gui thread
QFont: It is not safe to use text and fonts outside the gui thread
QWidget::setMinimumSize: The smallest allowed size is (0,0)
QFont: It is not safe to use text and fonts outside the gui thread
QFont: It is not safe to use text and fonts outside the gui thread
-------------------------------------------
Now I could ignore this warnings, after all, my little app works. But the big
app from gnu.classpath.examples.awt.Demo crashed several times.
So I googled for this warning and found
http://lists.trolltech.com/qt-interest/2006-01/msg00333.html
Trolltech states on
http://doc.trolltech.com/4.1/threads.html#threads-and-qobjects the following:
-------------------------------------------
Although QObject is reentrant, the GUI classes, notably QWidget and all its
subclasses, are not reentrant. They can only be used from the main thread. As
noted earlier, QCoreApplication::exec() must also be called from that thread.
-------------------------------------------
And that statement leads me to the assumption that the current design of
qt-peer is fundamentally broken. It calls GUI classes from other threads,
which is a No-No.