Qt World Summit: Register Today!

QVector Size assert

  • Hello,
    I am getting a strange error that is proving difficult to debug. It occurs at seemingly random times (i.e. I could just leave the software running and come back and it have happened). I get the following error:

    Program: C:\Qt\5.7\msvc2013_64\bin\Qt5Cored.dll
    Module: 5.7.0
    File: global\qglobal.cpp
    Line: 3063
    ASSERT: "d->size == asize" in file c:\users\qt\work\qt\qtbase\include\qtcore\../../src/corelib/tools/qvector.h, line 615

    and when I press retry and look at the stack trace it appears to occur somewhere in "QWidgetBackingStore::sync" following the stack trace up it goes through a lot of files which are just machine code until it ends up on my

    return app.exec();

    in main.cpp.

    Anyone have any idea what could cause this so I know where to start debugging?

  • Qt Champions 2017

    Any sample code which u can share ? This helps to look at.

  • The only case when I can see something like that happening is making a deep copy of the vector and either running out of memory (but this should trigger a bad_alloc) or, somehow, having a race condition on the vector... very strange... given the stack trace shows QWidgetBackingStore::sync I'd focus on any custom paint event. try commenting all of them out and see if the problem is still there

  • @mlathrop Post the backtrace for us to look at. It sounds as if you are deleting something that is still in use which cuases the assert in the QWidget backingStore.

    My guess is you delete a QWidget derived class that was still in use by something else. Check your code for things like delete myWidget and change them to myWidget->deleteLater(). That should help you find what is causing the problem.

    Also a backtrace might help. :)

Log in to reply