Random crash during setup(ui), retranslante step
-
@Christian-Ehrlicher
Thanks for the tip. To make sure I wasn't, I replaced my arg by a fixed value. Behavior is the same :(Furthermore, my code is executed a bit further and this line given my debug messages.
-
@Match0um said in Random crash during setup(ui), retranslante step:
I replaced my arg by a fixed value. Behavior is the same :(
I never told you to do so. As @JonB and I suggested you should check if the index you pass to operator[] is out-of-bounds - i.e. if the vector is big enough. For sure it isn't.
-
@Christian-Ehrlicher said in Random crash during setup(ui), retranslante step:
suggested you should check if the index you pass to operator[] is out-of-bounds
OK. By replacing
arg(_myVector[idx.row()]))
by
arg(cst)
the index and the vector are not used anymore ? No more out-of-bounds possibility, right ? But the problem subsists.
-
@Match0um said in Random crash during setup(ui), retranslante step:
But the problem subsists.
No, the crash must be on another place now since you now no longer call the function which crashes according your old backtrace. Take a look at the backtrace.
-
OK so now backtrace is leading me back to qaccessiblewidget...
1 RaiseFailFastException 0x7ffae7ae0c0f 2 qt_message_fatal qlogging.cpp 1892 0x6b78f454 3 QMessageLogger::fatal qlogging.cpp 887 0x6b78fe2b 4 qt_assert qglobal.cpp 3201 0x6b78acd1 5 QAccessibleWidget::window qaccessiblewidget.cpp 228 0x2a8f982f 6 QWindowsUiAutomation::hwndForAccessible qwindowsuiautils.cpp 89 0x39e43667 7 QWindowsUiaMainProvider::get_HostRawElementProvider qwindowsuiamainprovider.cpp 434 0x39e38689 8 UiaHostProviderFromHwnd 0x7ffac16af003 9 UiaHostProviderFromHwnd 0x7ffac16b07d3 10 UiaHostProviderFromHwnd 0x7ffac16aec5a 11 UiaRaiseAutomationEvent 0x7ffac16ad744 12 UiaRaiseAutomationEvent 0x7ffac16ad3fc 13 QWindowsUiaWrapper::raiseAutomationEvent qwindowsuiawrapper.cpp 113 0x39eef364 14 QWindowsUiaMainProvider::notifyTextChange qwindowsuiamainprovider.cpp 171 0x39e375ba 15 QWindowsUiaAccessibility::notifyAccessibilityUpdate qwindowsuiaaccessibility.cpp 123 0x39e36aa9 16 QAccessible::updateAccessibility qaccessible.cpp 875 0xf43569c 17 QWidgetLineControl::emitCursorPositionChanged qwidgetlinecontrol.cpp 1436 0x2a8150e0 18 QWidgetLineControl::finishChange qwidgetlinecontrol.cpp 749 0x2a816cb5 19 QWidgetLineControl::internalSetText qwidgetlinecontrol.cpp 776 0x2a8170f1 20 QWidgetLineControl::setText qwidgetlinecontrol_p.h 255 0x2a80be8a 21 QLineEdit::setText qlineedit.cpp 318 0x2a80be8a 22 QAbstractSpinBoxPrivate::updateEdit qabstractspinbox.cpp 1813 0x2a862ff3 23 QDoubleSpinBox::setSuffix qspinbox.cpp 764 0x2a865106 24 Ui_FicheSerrure::retranslateUi ui_ficheSerrure.h 3098 0x821094 25 Ui_FicheSerrure::setupUi ui_ficheSerrure.h 3039 0x843a45 26 FicheSerrure::nouvelle_ConfigGUI ficheSerrure.cpp 194 0x71278c 27 FicheSerrure::initialisations ficheSerrure.cpp 86 0x711d9c 28 FicheSerrure::FicheSerrure ficheSerrure.cpp 27 0x71198d 29 CatalogueSerrure::loadView catalogueSerrure.cpp 583 0x6d0033 30 CatalogueSerrure::qt_static_metacall moc_catalogueSerrure.cpp 134 0x7ac196 31 QMetaObject::activate qobject.cpp 3795 0x6b9412a8 32 QMetaObject::activate qobject.cpp 3648 0x6b9415c6 33 QAbstractButton::clicked moc_qabstractbutton.cpp 312 0x2a7c0ee7 34 ToolButton::event structure.cpp 1325 0x426ef8 35 QApplicationPrivate::notify_helper qapplication.cpp 3736 0x2a6d818e 36 QApplication::notify qapplication.cpp 3197 0x2a6df418 37 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1060 0x6b917768 38 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1462 0x6b9179ae 39 QApplicationPrivate::sendMouseEvent qapplication.cpp 2683 0x2a6de7bc 40 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 662 0x2a72fbe2 41 QWidgetWindow::event qwidgetwindow.cpp 281 0x2a73206b 42 QApplicationPrivate::notify_helper qapplication.cpp 3736 0x2a6d818e 43 QApplication::notify qapplication.cpp 3093 0x2a6df139 44 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1060 0x6b917768 45 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1462 0x6b9179ae 46 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 2102 0xf45b3e9 47 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1837 0xf45c85e 48 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 1151 0xf440503 49 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 82 0x39e46f39 50 qt_internal_proc qeventdispatcher_win.cpp 245 0x6b96c219 51 USER32!CallWindowProcW 0x7ffae8b95c1d 52 USER32!DispatchMessageW 0x7ffae8b95612 53 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 639 0x6b96b98d 54 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 74 0x39e46f17 55 QEventLoop::processEvents qeventloop.cpp 138 0x6b915e27 56 QEventLoop::exec qeventloop.cpp 225 0x6b916245 57 QCoreApplication::exec qcoreapplication.cpp 1363 0x6b91ee1a 58 QGuiApplication::exec qguiapplication.cpp 1779 0xf4523bf 59 QApplication::exec qapplication.cpp 2893 0x2a6d8070 60 qMain main.cpp 117 0x4027c9 61 WinMain qtmain_win.cpp 97 0x7b7bfa 62 __tmainCRTStartup 0x4013c7 63 WinMainCRTStartup 0x4014cb
-
@Match0um said in Random crash during setup(ui), retranslante step:
FicheSerrure::nouvelle_ConfigGUI
What exactly happens in this method (code)?
-
@jsulm
Here is the code. And as far as I understand, during the first operation, setupUi(this) get into Retranslate and then crash...void FicheSerrure::nouvelle_ConfigGUI() { //Configuration de l'interface utilisateur ui->setupUi(this); ConfigGUI::configView(this); this->setWindowTitle("Fiche Serrure"); ui->stackedWidget_photo->setCurrentIndex(0); ui->tabWidget_pageCle->clear(); ui->tabWidget_pageGoupille->clear(); ui->widget->addButton(ui->toolB_editer, 0, 0); ... ui->widget->addButton(ui->toolB_sauverPage, 0, 8); WidgetStacked* widgetStacked = new WidgetStacked(ui->page_visible); ui->gridLayout_pageVisible->addWidget(widgetStacked); widgetStacked->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); widgetStacked->addWidget(ui->page_axe1); widgetStacked->addWidget(ui->page_axe2); widgetStacked->setCurrentIndex(0); ui->tabWidget->tabBar()->installEventFilter(this); }
-
@Match0um There is an assert in
QAccessibleWidget::window qaccessiblewidget.cpp 228 0x2a8f982f
What exact Qt version do you use? Knowing the exact version we could check what happens in qaccessiblewidget.cpp at line 228, else it is hard to say.
OK, it is this:QWindow *QAccessibleWidget::window() const { const QWidget *w = widget(); Q_ASSERT(w); // This is the assert, means widget() returns nullptr QWindow *result = w->windowHandle(); if (!result) { if (const QWidget *nativeParent = w->nativeParentWidget()) result = nativeParent->windowHandle(); } return result; } QWidget *QAccessibleWidget::widget() const { return qobject_cast<QWidget*>(object()); } QObject *QAccessibleObject::object() const { return d->object; }
Looks like either d->object is not set (unlikely as it is set in constructor) or it is not QWidget. Could be a bug in Qt, you can check Qt bug tracker.
-
@Match0um said in Random crash during setup(ui), retranslante step:
ui->setupUi(this);
This is wrong - it creates new widgets every time this function is called!
setupUi() must only be called once in the ctor./edit:
WidgetStacked* widgetStacked = new WidgetStacked(ui->page_visible);
This is also wrong since you don't delete the old.
-
@Christian-Ehrlicher Oh, didn't notice it wasn't constructor!
-
@Christian-Ehrlicher said in Random crash during setup(ui), retranslante step:
setupUi() must only be called once in the ctor.
Sorry if it was not clear.
nouvelle_ConfigGUI() is called only once by my constructor. So not more than 1 call for setup(ui). (I double checked)Agreed on widget Stacked, so I temporarly took it out of the code, but issue remains.
I work on QT 5.12.3, I tried 5.12.9 but no improvements neither :(
-
Simplify the ui of the form until it no longer crashes. I would start by not setting the suffix for the spinbox as this is the current way how it crashes as you can see in the backtrace.
-
Hi,
One other thing that is not clear at all is why you are creating a WidgetStacked instance and then passing it widgets that belongs to FicheSerrure.
I must say your GUI building logic is a bit convoluted. You seem to have put different "subwidgets" in different classes and then you shuffle them around.
You might want to reconsider your design.
-
Hi,
Thanks all for your support.I totally agree on this weird building logic. Unfortunately, it is not mine, but a former developer's.
I was asked to fix this bug without changing evrything right now -_- . But I will try to change it a better way as soon I will be able to.Meantime, I took off widgetstacked, every single setSuffix or even DoubleSpinBox. But my app still crash at the same action, after a non defined times. And backtrace is not always the same neither :(
If anyone have any idea that could help, it would be welcome !
1 RaiseFailFastException 0x7ffb20770c0f 2 qt_message_fatal qlogging.cpp 1892 0x2125f454 3 QMessageLogger::fatal qlogging.cpp 887 0x2125fe2b 4 qt_assert qglobal.cpp 3201 0x2125acd1 5 QAccessibleWidget::window qaccessiblewidget.cpp 228 0x2ce8982f 6 QWindowsUiAutomation::hwndForAccessible qwindowsuiautils.cpp 89 0x3c243667 7 QWindowsUiaMainProvider::get_HostRawElementProvider qwindowsuiamainprovider.cpp 434 0x3c238689 8 UiaHostProviderFromHwnd 0x7ffaed52f003 9 UiaHostProviderFromHwnd 0x7ffaed5307d3 10 UiaHostProviderFromHwnd 0x7ffaed52ec5a 11 UiaRaiseAutomationEvent 0x7ffaed52d744 12 UiaRaiseAutomationEvent 0x7ffaed52d3fc 13 QWindowsUiaWrapper::raiseAutomationEvent qwindowsuiawrapper.cpp 113 0x3c2ef364 14 QWindowsUiaMainProvider::notifyFocusChange qwindowsuiamainprovider.cpp 109 0x3c237267 15 QWindowsUiaAccessibility::notifyAccessibilityUpdate qwindowsuiaaccessibility.cpp 108 0x3c236a8e 16 QAccessible::updateAccessibility qaccessible.cpp 875 0xf57569c 17 QWidget::setFocus qwidget.cpp 6581 0x2cca44d2 18 QApplication::setActiveWindow qapplication.cpp 2123 0x2cc6d2e0 19 QApplicationPrivate::notifyActiveWindowChange qapplication.cpp 2168 0x2cc6d3a1 20 QGuiApplicationPrivate::processActivatedEvent qguiapplication.cpp 2329 0xf59827f 21 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1858 0xf59c895 22 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 1151 0xf580503 23 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 82 0x3c246f39 24 qt_internal_proc qeventdispatcher_win.cpp 245 0x2143c219 25 USER32!CallWindowProcW 0x7ffb22745c1d 26 USER32!DispatchMessageW 0x7ffb22745612 27 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 639 0x2143b98d 28 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 74 0x3c246f17 29 QEventLoop::processEvents qeventloop.cpp 138 0x213e5e27 30 QEventLoop::exec qeventloop.cpp 225 0x213e6245 31 QCoreApplication::exec qcoreapplication.cpp 1363 0x213eee1a 32 QGuiApplication::exec qguiapplication.cpp 1779 0xf5923bf 33 QApplication::exec qapplication.cpp 2893 0x2cc68070 34 qMain main.cpp 117 0x4027c9 35 WinMain qtmain_win.cpp 97 0x7b773a 36 __tmainCRTStartup 0x4013c7 37 WinMainCRTStartup 0x4014cb
-
I would guess that there are a lot of 'dangling' widgets around due to re-creation of them during retranslate()