Qt6 application Crash on startup on Linux
-
We are porting an application from Qt 4.8.6 to Qt 6.2. The application is running fine on Windows and Mac but crashes on startup on Linux (CentOS 7)
The call stack with gdb is as follows1 QMetaType::canConvert qmetatype.cpp 2415 0x7fc394f79754
2 QVariant::canConvert qvariant.h 252 0x7fc394fe0916
3 QVariant::convert qvariant.cpp 2054 0x7fc394fdf48c
4 parseColorValue qcssparser.cpp 714 0x7fc396a7e58a
5 parseBrushValue qcssparser.cpp 814 0x7fc396a7f0aa
6 QCss::Declaration::brushValue qcssparser.cpp 1491 0x7fc396a82c9c
7 QCss::ValueExtractor::extractBackground qcssparser.cpp 1073 0x7fc396a80e11
8 QRenderRule::QRenderRule qstylesheetstyle.cpp 986 0x7fc3973d463c
9 QStyleSheetStyle::renderRule qstylesheetstyle.cpp 1854 0x7fc3973d965c
10 QStyleSheetStyle::setGeometry qstylesheetstyle.cpp 2571 0x7fc3973db69f
11 QStyleSheetStyle::polish qstylesheetstyle.cpp 2884 0x7fc3973dd8db
12 QWidget::event qwidget.cpp 8759 0x7fc39734a538
13 QLineEdit::event qlineedit.cpp 1510 0x7fc3975111f1
14 QApplicationPrivate::notify_helper qapplication.cpp 3396 0x7fc3972cc110
15 QApplication::notify qapplication.cpp 3346 0x7fc3972cbf18
16 ApplicationWithExceptionHandling::notify ApplicationWithExceptionHandling.cpp 66 0x1431971
17 MyApplication::notify My_Application.cpp 276 0x94bacf
18 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1061 0x7fc394f36944
19 QCoreApplication::sendEvent qcoreapplication.cpp 1469 0x7fc394f372f0
20 QWidget::ensurePolished qwidget.cpp 9907 0x7fc39734c152
21 QWidgetPrivate::setVisible qwidget.cpp 8078 0x7fc39734891b
22 QWidget::setVisible qwidget.cpp 8052 0x7fc3973487b2The last function call is setVisible() on a QLineEdit and the last event received by notify() method is QEvent::Polish
There is also error printed on terminal on application startup before crash
X Error: BadWindow (invalid Window parameter) 3
Major opcode: 15
Minor opcode: 0
Resource id: 24 -
Check if you can reproduce this with some minimal example - if yes please report it on Qt bug tracker.
There have been important changes to QMetaType and QVariant, that may be the cause of this: https://doc-snapshots.qt.io/qt6-dev/qtcore-changes-qt6.html#the-qvariant-class
-
@nitingera said in Qt6 application Crash on startup on Linux:
from Qt 4.8.6 to Qt 6.2.
from Qt 4.8.6 to Qt 6.2===> pretty big jump. 5.15.2 might be a better choice.
-
Hi,
The two steps port is not a bad idea. Follow the porting guide from Qt 4 to Qt 5 and then do the small adjustments for Qt 6.
Depending on what you are using you should wait for 6.2 so it's still a good idea to go through 5.15
-
Which version of Qt are you using on Linux ?
Did you try to start from an empty stylesheet and add back elements until it crashes ?
Which version of Linux are you using ?
-
Built the Qt6.2 branch on CentOS 7.6
The debug output gives this call stack
1 QMetaType::canConvert qmetatype.cpp 2415 0x7fffee147754
2 QVariant::canConvert qvariant.h 252 0x7fffee1ae916
3 QVariant::convert qvariant.cpp 2054 0x7fffee1ad48c
4 parseColorValue qcssparser.cpp 714 0x7fffefc4c58a
5 parseBrushValue qcssparser.cpp 814 0x7fffefc4d0aa
6 QCss::ValueExtractor::borderValue qcssparser.cpp 1009 0x7fffefc4e808
7 QCss::ValueExtractor::extractBorder qcssparser.cpp 631 0x7fffefc4bebc
8 QRenderRule::QRenderRule qstylesheetstyle.cpp 968 0x7ffff06b7469
9 QStyleSheetStyle::renderRule qstylesheetstyle.cpp 1854 0x7ffff06bc65c
10 QStyleSheetStyle::setGeometry qstylesheetstyle.cpp 2571 0x7ffff06be69f
11 QStyleSheetStyle::polish qstylesheetstyle.cpp 2884 0x7ffff06c08db
12 QWidget::event qwidget.cpp 8759 0x7ffff062d538
13 QApplicationPrivate::notify_helper qapplication.cpp 3396 0x7ffff05af110
14 QApplication::notify qapplication.cpp 3346 0x7ffff05aef18
15 My_Application::notify My_Application.cpp 490 0x7ffff7e46343
16 My_Application::notify My_Application.cpp 64 0x7ffff1bc190e
17 MyApplicationWithExceptionHandling::notify MyApplicationWithExceptionHandling.cpp 66 0x113d179
18 MyApplication::notify My_Application.cpp 301 0x96112a
19 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1061 0x7fffee104944
20 QCoreApplication::sendEvent qcoreapplication.cpp 1469 0x7fffee1052f0
21 QWidget::ensurePolished qwidget.cpp 9907 0x7ffff062f152
22 QWidget::ensurePolished qwidget.cpp 9916 0x7ffff062f1de
23 QWidget::ensurePolished qwidget.cpp 9916 0x7ffff062f1de
24 QWidgetPrivate::setVisible qwidget.cpp 8078 0x7ffff062b91b
25 QWidget::setVisible qwidget.cpp 8052 0x7ffff062b7b2
26 QWidget::show qwidget.cpp 7678 0x7ffff062a5c7
27 QStackedLayout::setCurrentIndex qstackedlayout.cpp 323 0x7ffff060cffa
28 QStackedLayout::insertWidget qstackedlayout.cpp 233 0x7ffff060cc0e
29 QStackedWidget::insertWidget qstackedwidget.cpp 181 0x7ffff089e88d
30 My_LayoutFrame::addTab myulayoutframe.cpp 459 0x7ffff4af0427
31 My_LayoutArea::add mylayoutarea.cpp 94 0x7ffff4ae8a25 -
@SGaist Can it be due to missing style plugin on Linux?
As there are style plugins for Mac and Windows (qwindowsvistastyle.dll) in plugin/styles but nothing for Linux.
Maybe any missing dependency while building?The Config summary states the following
Qt Widgets:
GTK+ ................................... yes
Styles ................................. Fusion Windows -
Sorry, I lost track of this thread.
No as in the case of style sheets there's a dedicated QStyle subclass for it.
Can you reproduce that with a minimal compilable example ?
-
@SGaist
Although I can't produce a minimal compilable example as of now but I could find atleast one instance where it is crashing
This line crashes
framePoint->setStyleSheet(QString("border: 1px solid lightGray; background-color: rgb(%1, %2, %3 );")).arg(backgroundCol.red()).arg(backgroundCol.green()).arg(backgroundCol.blue());But this one works fine
framePoint->setStyleSheet(QString("border: 1px; border-color: rgb(211, 211, 211); background-color: rgb(%1, %2, %3 );")).arg(backgroundCol.red()).arg(backgroundCol.green()).arg(backgroundCol.blue());Maybe some issue with parsing in stylesheet
-
You may have found a bug.
Can you reproduce that on a dummy widget ?