QQuickView crashes when qml file is loaded
-
Hi,
When running the following test app on OSX (10.8.4, PyQt 5.1 snapshot + Qt 5.1)
https://github.com/pyinstaller/pyinstaller/blob/develop/tests/interactive/test_pyqt5_qml.py
I get a crash (stack trace below) when the app is frozen using PyInstaller, but not when running it directly.
Can anyone suggest what might be causing this or how to diagnose it further?
I'm asking here because the stack trace shows that the crash happens in a QThread and there are no Python related calls involved.
Glenn
@
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000004Thread 4 Crashed:: QThread
0 QtQml_debug 0x0c8af5dd QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data() const + 13 (qscopedpointer.h:132)
1 QtQml_debug 0x0c8be1e7 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::pointer qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > >(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > const&) + 23 (qglobal.h:886)
2 QtQml_debug 0x0c8c9c0c QObject::d_func() + 28 (qobject.h:118)
3 QtQml_debug 0x0c8be367 QObjectPrivate::get(QObject*) + 23 (qobject_p.h:190)
4 QtQml_debug 0x0cae15ff QQmlDebugServer::instance() + 63 (qqmldebugserver.cpp:273)
5 QtQml_debug 0x0cadb2ab QQmlDebugService::isDebuggingEnabled() + 11 (qqmldebugservice.cpp:269)
6 QtQuick_debug 0x0c3be966 QQmlQtQuick2Module::defineModule() + 182 (qtquick2.cpp:183)
7 libqtquick2plugin_debug.dylib 0x01ff2347 QtQuick2Plugin::registerTypes(char const*) + 167 (plugin.cpp:59)(lines removed because of character limit)
35 QtCore_debug 0x018130e6 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 550 (qeventloop.cpp:212)
36 QtCore_debug 0x01566fe7 QThread::exec() + 183 (qthread.cpp:507)
37 QtQml_debug 0x05d12759 QQmlThreadPrivate::run() + 73 (qqmlthread.cpp:149)
38 QtCore_debug 0x01570ba4 QThreadPrivate::start(void*) + 868 (qthread_unix.cpp:339)
39 libsystem_c.dylib 0x931f25b7 _pthread_start + 344
40 libsystem_c.dylib 0x931dcd4e thread_start + 34
@ -
Running it in the debugger I see that it seems to be a bad QScopedPointer.
- thread #5: tid = 0x2503, 0x0a6ce51d QtQml_debug
QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data(this=0x00000004) const + 13 at qscopedpointer.h:132, stop reason = EXC_BAD_ACCESS (code=2, address=0x4) frame #0: 0x0a6ce51d QtQml_debug
QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data(this=0x00000004) const + 13 at qscopedpointer.h:132
@ 129
130 inline T *data() const
131 {
-> 132 return d;
133 }
134
135 inline bool isNull() const
@
- thread #5: tid = 0x2503, 0x0a6ce51d QtQml_debug
-
It seems that the crash happens because in qqmldebugserver.cpp:273 qApp (which appears to be a macro for QCoreApplication::instance() ) is 0 and the following assert confirms this:
@
QQmlDebugServer *QQmlDebugServer::instance()
{
static bool commandLineTested = false;if (!commandLineTested) { commandLineTested = true; Q_ASSERT(qApp); // assert fails QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp));
@
Why would QCoreApplication::instance() be 0 in a frozen app and not in a non frozen one?