Important: Please read the Qt Code of Conduct -

QML application crashes, How to debug it?

  • Hi,

    I've written an application with qtQuick (integrated with QtWidgets via createWindowContainer) bug it crashes and I have no idea where it initiates the crash.

    Is there any way to debug it to trace it?

  • Moderators

    Compile in debug mode, run with debugger attached (F5 in Qt Creator and other IDEs), the debugger will show you where the crash occurs - even if you don't specify any breakpoints. If that does not work, then run memory analysis with valgrind - it will also show you where the crash occurs and can provide better stack traces.

  • The debugger doesn't works so I'll try with valgrind.

  • This is the callstack:
    0 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data qscopedpointer.h 143 0x988250c
    1 qGetPtrHelper<QScopedPointer<QObjectData> > qglobal.h 941 0x9541cc7
    2 QOpenGLContext::d_func qopenglcontext.h 148 0x9881f9b
    3 QOpenGLContext::isValid qopenglcontext.cpp 596 0x95405d1
    4 GLAcquireContext::GLAcquireContext qquickcontext2dtexture.cpp 75 0x2118ec21
    5 QQuickContext2DTexture::paint qquickcontext2dtexture.cpp 247 0x21102b79
    6 QQuickContext2DTexture::event qquickcontext2dtexture.cpp 366 0x211034a1
    7 QApplicationPrivate::notify_helper qapplication.cpp 3500 0x2755ded3
    8 QApplication::notify qapplication.cpp 2953 0x2755b985
    9 QCoreApplication::notifyInternal qcoreapplication.cpp 935 0x6b929f96
    10 QCoreApplication::sendEvent qcoreapplication.h 237 0x6b9cf2db
    11 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1539 0x6b92b14e
    12 QEventDispatcherWin32::sendPostedEvents qeventdispatcher_win.cpp 1143 0x6b97b006
    13 qt_internal_proc(HWND__, unsigned int, unsigned int, long)@16 qeventdispatcher_win.cpp 421 0x6b978708
    14 gapfnScSendMessage C:\Windows\syswow64\user32.dll 0x76ac62fa
    15 ?? 0x905ea
    16 USER32!GetThreadDesktop C:\Windows\syswow64\user32.dll 0x76ac6d3a
    17 __lambda0::operator() qeventdispatcher_win.cpp 364 0x6b978443
    18 ?? 0x905ea
    19 USER32!CharPrevW C:\Windows\syswow64\user32.dll 0x76ac77c4
    20 USER32!DispatchMessageW C:\Windows\syswow64\user32.dll 0x76ac788a
    21 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 756 0x6b979a0b
    22 QEventLoop::processEvents qeventloop.cpp 136 0x6b92803c
    23 QEventLoop::exec qeventloop.cpp 212 0x6b9282d7
    24 QThread::exec qthread.cpp 511 0x6b795f49
    25 QThread::run qthread.cpp 578 0x6b7960b1
    26 QThreadPrivate::start(void
    )@4 qthread_win.cpp 407 0x6b798b3e
    27 msvcrt!_itow_s C:\Windows\syswow64\msvcrt.dll 0x76f41287
    28 msvcrt!_endthreadex C:\Windows\syswow64\msvcrt.dll 0x76f41328
    29 KERNEL32!BaseThreadInitThunk C:\Windows\syswow64\kernel32.dll 0x75a7338a
    30 ntdll!RtlInitializeExceptionChain C:\Windows\system32\ntdll.dll 0x77e99f72
    31 ntdll!RtlInitializeExceptionChain C:\Windows\system32\ntdll.dll 0x77e99f45
    32 ??

  • Moderators

    Hm, that is not exactly helping all that much, apart from telling us the problem is probably not caused by your code.

  • I'm so disappointed and exhausted. It took my time for more than one week and no solution!

  • Moderators

    Maybe switch to Qt 5.4 (in RC stage right now), it contains QQuickWidget, which should be much easier to use. Qt 5.4 fixes a lot of bugs in general, so maybe the one in createWindowContainer is also fixed.

  • Good Idea. I'll try it ASAP and let you know the result. Thanks.

  • Hi again,
    I recompiled the project with Qt5.4mingw and the bug (crash) is gone!!!!

    Moreover, I've replaced the QQuickView and createWindowContainer with QQuickWidget, but I am a little worried about the performance of QQuickWidget. Do you know about the performance issue of QQuickWidget? Also, recently I've heard that QML is rendered in new thread (from Qt5.3). Is this true for both QQuickView and QQuckWidget?

    However when I run it with QQuickWidget, the mouse events are processed with lag bug the performance of animations seems to be improved.

    Thanks in advance,

  • Moderators

    Some info is available here: "link": Apart from that, there is the documentation.

    QQuickWidget indeed does have it's limitations.

Log in to reply