> ------------------------------------------------------------------- > QFont: It is not safe to use text and fonts outside the gui thread > ------------------------------------------------------------------- > > See my earlier mail, > http://developer.classpath.org/pipermail/classpath/2006-February/000069.htm >l Hmm, it might be the case that this is really some weird interoperability between pthread's usage of Qt, the VM and Classpath. First a look at the function that creates this warning, in // from src/gui/text/qfont.cpp: void qt_font_tread_test() { if (QApplication::instance() && QThread::currentThread() != QApplication::instance()->thread()) qWarning("QFont: It is not safe to use text and fonts outside \ the gui thread"); } This function get's called in two of the four QFont constructors. QApplication::instance() returns the QApplication object or NULL. QThread::currentThread() is defined as a static method like this: // from src/corelib/thread/qthread_unix.cpp: QThread *QThread::currentThread() { pthread_once(¤t_thread_key_once, create_current_thread_key); return reinterpret_cast<QThread *> (pthread_getspecific(current_thread_key)); } This means that some thread id is stored in the per-thread specific area of each thread and that Qt just safely casts this to a QThread pointer. QApplication::instance()->thread() just points is to the thread() method of the QObject: // src/corelib/kernel/qobject.cpp QThread *QObject::thread() const { return QThreadPrivate::threadForId(d_func()->thread); } But here my knowledge is at the end. I've no knowledge about the internals of Qt's d_func or QThreadPrivate. When I augment the qt_font_tread_test() from above and let a mini AWT app run, then I see: Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread QWidget::setMinimumSize: The smallest allowed size is (0,0) Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread QWidget::setMinimumSize: The smallest allowed size is (0,0) Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread Java_gnu_java_awt_peer_qt_QtFontPeer_create: (nil) QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() QFont: It is not safe to use text and fonts outside the gui thread Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QThread::currentThread() Java_gnu_java_awt_peer_qt_QtFontPeer_create: 0x8093618 QApplication::instance()->thread() Now, what to make out of this info?