PyQt4 QCoreApplication Crash

   4572   1   1
User Avatar
Member
382 posts
Joined: July 2005
Offline
This was working well for us for quite some time
to allow multiple instances of pyqt apps to launch.

app = QApplication.instance()
if app is None: app = QApplication()
win = MainWindow(app)
pyqt_houdini.exec_(app,win)


Something has changed recently and i can't quite put
my finger on it, most likely with the version of PyQt
we have upgraded to. Houdini will now crash every time
we attempt to launch a second instance of a pyqt app
that is already open on the first line where the QApplication
instance is requested. Heres the error and the crash log:

ASSERT failure in QCoreApplication: “there should be only one application object”, file kernel/qcoreapplication.cpp, line 466
(sent by pid 23748)Internal abort

rash report from sdugaro; Houdini Master Version 10.0.345
Traceback from Fri Feb 18 14:49:11 2011
Caught signal 6
AP_Interface::coredumpHandler(UTsignalHandlerArg) (??:0)
UT_Signal::UT_ComboSignalHandler:perator()(int, siginfo*, void*) const (??:0)
UT_Signal::processSignal(int, siginfo*, void*) (??:0)
<unknown>
gsignal+0x39
abort+0x175
qt_message_output(QtMsgType, char const*)+0x78
qFatal(char const*, …)+0xd1
QCoreApplication::init()+0x62
QCoreApplication::QCoreApplication(QCoreApplicationPrivate&)+0x2f
QApplication::QApplication(int&, char**, int)+0x54
<unknown>
<unknown>
<unknown>
type_call (typeobject.c:436)
PyObject_Call (abstract.c:1860)
do_call (ceval.c:3784)
fast_function (ceval.c:3659)
PyEval_EvalCodeEx (ceval.c:2836)
PyEval_EvalCode (ceval.c:494)
PY_CompiledCode::evaluateUsingDicts(PY_Result::Type, void*, void*, PY_Result&) const (??:0)
pyRunPythonInCurrentThread(char const*, PY_Result::Type, PY_CompiledCode::CodeType, char const*, PY_EvaluationContext*) (PY_Python.C:0)
PYrunPythonStatementsFromFile(char const*, PY_EvaluationContext*) (??:0)
SI_MainMenu::handleHotkey(UI_Event*, UT_Options const*) (??:0)
OPUI_App::defaultKeyboardHandler(UI_Event*) (??:0)
FUSE_App::handleKeyboardEvent(UI_Event*) (??:0)
UI_Queue::processNextEvent() (??:0)
UI_Queue::drain() (??:0)
UI_Queue::eventLoop() (??:0)
main (??:0)


Anyone come across this? Its as if the instance returned is a null
pointer or the assertion terminates the app, including its parent
thread. Any Idea how to work around this?
User Avatar
Member
382 posts
Joined: July 2005
Offline
Ah, found the problem.
I had a secondary pyqt application that was being imported by the first.
(a preliminary checker that would popup and request some user input)
That secondary app did not check for a QApplication.instance(). It just
created its own. PyQt 4 requires that only 1 application instance exists
per thread. Since each of these QApps were launched from the main
houdini thread, PyQt would assert and quit, taking down the apps and
the parent process it derived from.
  • Quick Links