Unsolved Random crash during setup(ui), retranslante step
-
@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()