Qut of memory in QVector
-
@Tikani But it could help to see where in your app you are when the crash happens and in which state the app is (values of variables, ...). Bugs in frameworks are rare, so most probably it is something in your app, but actual crash happens inside Qt (but not because of a Qt bug).
-
@jsulm Ok, then I try to rebuild Qt with debug information and post here a link to GitHub with my project (it's opensource) as well, may be then things get clearer for true Jedis :D may be there is a need in a big picture to resolve the problem.
-
@Tikani No! There is no need to rebuild Qt at this stage! I don't ask you to debug Qt - it will most probably not help you. Simply run your app through debugger until it crashes and see where in your app you are at that time.
In most cases (from my own experience) if your app crashes somewhere in Qt it is NOT Qt but your app which is doing something wrong. -
@jsulm OK, I got the point. I attach stacktrace and full code a little bit later - I need to go to work now :( Thanks anyway for the fastness of responses - now I'm confident that my issue would be resolved eventually with help of the community.
-
Hi
I see that you are using 32 bit.
How many model items do you add ? -
Hi,
@Tikani said in Qut of memory in QVector:
QList<Task> *tasks = nullptr; // Внутреннее хранилище всех задач
Why are you using a pointer for
tasks
? I don't see it initialised anywhere. -
@SGaist It is just an inner storage over which subclassed model works. I forgot to comment it after my experiments with fields and its types, when I tried to locate a culprit of a aprogram crash. Anyway, it doesn't initialize in any way, it is just empty nullptr junk pointer.
By the way, here stacktrace comes:1 msvcrt!abort 0x7732b3fb 2 libstdc++-6!_ZN9__gnu_cxx27__verbose_terminate_handlerEv 0x1768085d 3 libstdc++-6!_ZN10__cxxabiv111__terminateEPFvvE 0x17679399 4 libstdc++-6!_ZSt9terminatev 0x17713930 5 qt_check_pointer qglobal.cpp 3050 0x6b98abc1 6 QVector<QHeaderViewPrivate::SectionItem>::reallocData qvector.h 551 0xde2dc07 7 QVector<QHeaderViewPrivate::SectionItem>::resize qvector.h 416 0xde2e4ce 8 QHeaderViewPrivate::createSectionItems qheaderview.cpp 3530 0xdcd1a3d 9 QHeaderView::initializeSections qheaderview.cpp 2279 0xdcd2572 10 QHeaderView::initializeSections qheaderview.cpp 2205 0xdcd5918 11 QHeaderView::reset qheaderview.cpp 1774 0xdcd9584 12 QAbstractItemView::setModel qabstractitemview.cpp 748 0xdcc0764 13 QHeaderView::setModel qheaderview.cpp 408 0xdcd94e0 14 QTableView::setModel qtableview.cpp 1136 0xdd140d6 15 MainWindow::MainWindow mainwindow.cpp 15 0x401910 16 qMain main.cpp 11 0x4016f4 17 WinMain *16 qtmain_win.cpp 104 0x404d85 18 main 0x40934d
-
There's always a need to return something when your method has a return type. If you don't know what to return at first then return a default value.
Also, always take into account the warnings the compiler throws at you (there is one for functions not returning anything when their signature contains a return type). As the old saying goes: a compiler warning ignored today is a catastrophic crash in production tomorrow.