Unsolved QVector append QString in member function crash application
-
I create a custom talbe model that implements QAbstructTableModel.
```
my_table_model.h:
class MyTableModel : public QAbstractTableModel { Q_OBJECT public: explicit MyTableModel(QObject *parent = nullptr); ... void update(); private: QVector<QString> cities; }; my_table_model.cpp #include "my_table_model.h" MyTableModel::MyTableModel(QObject *parent) : QAbstractTableModel(parent) { cities.append("Shanghai"); // Ok it works } void MyTableModel::update() { cities.append("Hangzhou"); // crash application } }
1 QVector<QString>::append(QString const&) qvector.h 790 0x100013a44 2 MyTableModel::update() base_table_model.cpp 40 0x1000139ff 3 BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1::operator()() const base_dashboard.cpp 155 0x100011621 4 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1>::call(BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1&, void * *) qobjectdefs_impl.h 146 0x1000115b9 5 void QtPrivate::Functor<BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1, 0>::call<QtPrivate::List<>, void>(BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1&, void *, void * *) qobjectdefs_impl.h 256 0x100011571 6 QtPrivate::QFunctorSlotObject<BaseDashboard::BaseDashboard(QApplication *, bool, unsigned int, QWidget *)::$_1, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *) qobjectdefs_impl.h 443 0x10001151c 7 QtPrivate::QSlotObjectBase::call(QObject *, void * *) qobjectdefs_impl.h 398 0x1013d02e5 8 void doActivate<false>(QObject *, int, void * *) qobject.cpp 3886 0x1013d02d0 9 QAbstractButton::clicked(bool) moc_qabstractbutton.cpp 308 0x10040fa1f 10 QAbstractButtonPrivate::emitClicked() qabstractbutton.cpp 415 0x10040f9f7 11 QAbstractButtonPrivate::click() qabstractbutton.cpp 408 0x10040f899 12 QAbstractButton::mouseReleaseEvent(QMouseEvent *) qabstractbutton.cpp 1044 0x100410a4f 13 QWidget::event(QEvent *) qwidget.cpp 8653 0x1003607bd 14 QApplicationPrivate::notify_helper(QObject *, QEvent *) qapplication.cpp 3671 0x100325fea 15 QApplication::notify(QObject *, QEvent *) qapplication.cpp 3115 0x100328ec2 16 QCoreApplication::notifyInternal2(QObject *, QEvent *) qcoreapplication.cpp 1061 0x10139cd64 17 QApplicationPrivate::sendMouseEvent(QWidget *, QMouseEvent *, QWidget *, QWidget *, QWidget * *, QPointer<QWidget>&, bool, bool) qapplication.cpp 2603 0x100326910 18 QWidgetWindow::handleMouseEvent(QMouseEvent *) qwidgetwindow.cpp 675 0x10037f99f 19 QWidgetWindow::event(QEvent *) qwidgetwindow.cpp 295 0x10037e0a5 20 QApplicationPrivate::notify_helper(QObject *, QEvent *) qapplication.cpp 3671 0x100325fea 21 QApplication::notify(QObject *, QEvent *) qapplication.cpp 0x100327476 22 QCoreApplication::notifyInternal2(QObject *, QEvent *) qcoreapplication.cpp 1061 0x10139cd64 23 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *) qguiapplication.cpp 2214 0x100980ca5 24 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) qwindowsysteminterface.cpp 1175 0x100965e5b 25 QCocoaEventDispatcherPrivate::processPostedEvents() qcocoaeventdispatcher.mm 905 0x106b85e00 26 QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *) qcocoaeventdispatcher.mm 927 0x106b86568 27 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff34833d52 28 __CFRunLoopDoSource0 (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff34833cf1 29 __CFRunLoopDoSources0 (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff34833b0b 30 __CFRunLoopRun (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff3483283a 31 CFRunLoopRunSpecific (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff34831e3e 32 RunCurrentEventLoopInMode (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7fff3345eabd 33 ReceiveNextEventCommon (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7fff3345e6f4 34 _BlockUntilNextEventMatchingListInModeWithFilter (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7fff3345e579 35 _DPSNextEvent (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7fff31aa4039 36 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7fff31aa2880 37 -[NSApplication run] (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7fff31a9458e 38 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qcocoaeventdispatcher.mm 437 0x106b851cf 39 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 139 0x101398e0f 40 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 232 0x101398deb 41 QCoreApplication::exec() qcoreapplication.cpp 1369 0x10139d372 42 main main.cpp 11 0x10001e8d5 43 start (x86_64) /usr/lib/system/libdyld.dylib 0x7fff6e8a3cc9 44 start (x86_64) /usr/lib/system/libdyld.dylib 0x7fff6e8a3cc9 When i invoke update() method by QPushbutton , the application is crashed with isTooSmall. How to resolve this problem?
-
@ryman said in QVector append QString in member function crash application:
with isTooSmall
Please provide whole error message and stack trace.
-
And the implementation of BaseDashboard ctor - I would guess you access an uninitialized variable.
-
@ryman please do not delete posts once you received an answer - that is bad habit.
Thanks and regards