Important: Please read the Qt Code of Conduct -

QQmlImageProviderBase::ForceAsynchronousImageLoading causing application crash

  • Hey guys, I am trying to figure out why: QQmlImageProviderBase::ForceAsynchronousImageLoading would be causing the application to crash when setting asynchronous: true in QML. Here is how it's being done:

    QQuickImageProvider(QQmlImageProviderBase::Image, QQmlImageProviderBase::ForceAsynchronousImageLoading)

    The signal to refresh the image sent to the front end comes very rapidly and not using the asynchronous: true seems to be burdening the system quite a bit. I am wondering if perhaps calling the QQmlImageProviderBase::ForceAsynchronousImageLoading is unnessasary or if it is necessary in order to attain asynchronous loading and if not, why that might be causing the system to crash with the following application output:

    QImage: out of memory, returning null image

    Here is the stack dump:
    1 __GI_raise raise.c 51 0x7ffff5a9afb7
    2 __GI_abort abort.c 79 0x7ffff5a9c921
    3 __libc_message libc_fatal.c 181 0x7ffff5ae5967
    4 malloc_printerr malloc.c 5342 0x7ffff5aec9da
    5 _int_free malloc.c 4167 0x7ffff5af3f0c
    6 __GI___libc_free malloc.c 3134 0x7ffff5af3f0c
    7 QArrayData::deallocate qarraydata.cpp 167 0x7ffff64a0d7e
    8 QTypedArrayData<unsigned short>::deallocate qarraydata.h 237 0x7ffff658d299
    9 QString::~QString qstring.h 1130 0x7ffff658d299
    10 QDebug::Stream::~Stream qdebug.h 69 0x7ffff658d299
    11 QDebug::~QDebug qdebug.cpp 158 0x7ffff658d299
    12 TeeJet::GallatinUi::IsoBusView::paint IsoBusView.cpp 55 0x7ffff78fa629
    13 QSGDefaultPainterNode::paint qsgdefaultpainternode.cpp 177 0x7ffff3c9d342
    14 QSGDefaultPainterNode::update qsgdefaultpainternode.cpp 205 0x7ffff3c9df31
    15 QQuickPaintedItem::updatePaintNode qquickpainteditem.cpp 611 0x7ffff3d536af
    16 QQuickWindowPrivate::updateDirtyNode qquickwindow.cpp 3450 0x7ffff3d0c9c1
    17 QQuickWindowPrivate::updateDirtyNodes qquickwindow.cpp 3195 0x7ffff3d0d0f3
    18 QQuickWindowPrivate::syncSceneGraph qquickwindow.cpp 431 0x7ffff3d0d278
    19 QSGGuiThreadRenderLoop::renderWindow qsgrenderloop.cpp 424 0x7ffff3c86e4a
    20 QSGGuiThreadRenderLoop::handleUpdateRequest qsgrenderloop.cpp 524 0x7ffff3c876ef
    21 QQuickWindow::event qquickwindow.cpp 1615 0x7ffff3d13ff1
    22 QCoreApplicationPrivate::notify_helper qcoreapplication.cpp 1196 0x7ffff66612f0
    23 doNotify qcoreapplication.cpp 1137 0x7ffff6661397
    24 QCoreApplication::notify qcoreapplication.cpp 1123 0x7ffff66614fb
    25 QGuiApplication::notify qguiapplication.cpp 1771 0x7ffff6fb5ad5
    26 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1047 0x7ffff666142f
    27 QCoreApplication::sendEvent qcoreapplication.h 234 0x7ffff6fc6126
    28 QWindowPrivate::deliverUpdateRequest qwindow.cpp 2372 0x7ffff6fc6126
    29 QWindow::event qwindow.cpp 2343 0x7ffff6fc65ae
    30 QQuickWindow::event qquickwindow.cpp 1634 0x7ffff3d13fa7
    31 QCoreApplicationPrivate::notify_helper qcoreapplication.cpp 1196 0x7ffff66612f0
    32 doNotify qcoreapplication.cpp 1137 0x7ffff6661397
    33 QCoreApplication::notify qcoreapplication.cpp 1123 0x7ffff66614fb
    34 QGuiApplication::notify qguiapplication.cpp 1771 0x7ffff6fb5ad5
    35 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1047 0x7ffff666142f
    36 QCoreApplication::sendEvent qcoreapplication.h 234 0x7ffff66be1a7
    37 QTimerInfoList::activateTimers qtimerinfo_unix.cpp 643 0x7ffff66be1a7
    38 timerSourceDispatch qeventdispatcher_glib.cpp 182 0x7ffff66bea17
    39 idleTimerSourceDispatch qeventdispatcher_glib.cpp 229 0x7ffff66bea38
    40 g_main_context_dispatch 0x7ffff267f537
    41 ?? 0x7ffff267f770
    42 g_main_context_iteration 0x7ffff267f7fc
    43 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 422 0x7ffff66bedc2
    44 QPAEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 69 0x7fffefca7115
    45 QEventLoop::processEvents qeventloop.cpp 136 0x7ffff665f371
    46 QEventLoop::exec qeventloop.cpp 214 0x7ffff665f7bf
    47 QCoreApplication::exec qcoreapplication.cpp 1335 0x7ffff666967c
    48 QGuiApplication::exec qguiapplication.cpp 1762 0x7ffff6fb0438
    49 main main.cpp 276 0x555555559d3c

    Perhaps the problem is dervived by the way I am using paint to initalize the image in the constructor:

        QQuickImageProvider(QQmlImageProviderBase::Image, QQmlImageProviderBase::ForceAsynchronousImageLoading),
        QImage image(prjcfgISO11783UT_datamaskWidth+2, prjcfgISO11783UT_datamaskHeight+2, QImage::Format_Mono);
        QPainter painter;
        painter.drawText(QRect(0, 0, prjcfgISO11783UT_datamaskWidth+2, prjcfgISO11783UT_datamaskHeight+2), Qt::AlignCenter, tr("not connected"));
        m_image = image;

  • Qt Champions 2017

    @RobM said in QQmlImageProviderBase::ForceAsynchronousImageLoading causing application crash:

    Perhaps the problem is dervived by the way I am using paint to initalize the image in the constructor:

    Not according to the stack trace you provided.

    Look here: TeeJet::GallatinUi::IsoBusView::paint
    What does this do at line 55?

    The bottom part of the stack looks like a double deallocation ... but it's hard to tell from the stack alone.

  • Which portion are your referring too? By double deallocation do you mean a double free()?

  • Qt Champions 2017

    @RobM said in QQmlImageProviderBase::ForceAsynchronousImageLoading causing application crash:

    Which portion are your referring too?

    Sorry, I meant the top of the stack, my bad - from #11 to #1

    By double deallocation do you mean a double free()?

    Yes. A double delete probably, but more or less it's the same thing. Specifically #9 is rather suspicious (due to #5). It appears the crash happens when cleaning up the QString's data, which, as it being rather tested and I know it works, suggests that this data was already freed someplace else.
    Please provide the code around the requested region.

Log in to reply