Eskil, actually in my example case the exception happened during the application startup, before the call to QApplication.exec(). According to the documentation QApplication.exit() does nothing, when the event loop is not started yet.
However, I did find the cause for the crash. One of the first things my app does is install a QMessageHandler with QMessageHandler.installMessageHandler(...), to properly log some of the Jambi errors. If I call System.exit() without having unregistered the installed QMessageHandler with QMessageHandler.removeMessageHandler(...) Jambi crashes. If I remove the handler before the System.exit() call the shutdown is completed nicely. Well, actually not quite... :) No seg fault anymore, just the following message at the very end: QObject::killTimers: timers cannot be stopped from another thread I don't know how to get rid of that one (during that particular code path in my exception example I don't start any other threads). What exactly are the reasons for the warning about "QObject::killTimers" ? Cheers and thanks for your support, Mathias On Mon, Feb 9, 2009 at 10:46 AM, Eskil Abrahamsen Blomfeldt < [email protected]> wrote: > Mathias wrote: > >> Everything works as expected except for the seg fault at the very end (see >> attachment). >> >> Am I missing a crucial clean up step before the System.exit() ? >> > > When you use System.exit() you aren't letting QApplication clean up its > resources properly. Could you try using QApplication.exit() instead? If you > need to return an exit code from your process, you could do something like > this: > > import com.trolltech.qt.gui.*; > > public class SystemExit { > > > public static void main(String args[]) { > QApplication.initialize(args); > > QApplication.invokeLater(new Runnable() { > public void run() { > QMessageBox.critical(null, "error", "error"); > QApplication.exit(1); > } > }); > > int err = QApplication.exec(); > System.exit(err); > } > > } > > > -- Eskil >
_______________________________________________ Qt-jambi-interest mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
