summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-03-03 10:53:04 +0100
committerMarc Mutz <marc.mutz@qt.io>2025-03-03 23:08:02 +0100
commit66268742861c3eb9b3d97c2758a1babbae850e1f (patch)
treea22a9b17eed96e73dfb40f28ead17bf20519f5a6 /src/widgets/kernel/qwidget.cpp
parent5e936b60fc921e21b8153a83113886a1de333b57 (diff)
QWidget: DRY the ctors, use ctor delegation
Don't repeat the body in the two QWidgets ctors, call one from the other instead. This will help fighting Coverity's hallucination that QWidget::data is used uninitialized, or, after 58b9250aea0b1b41c8cbd1033149371a93a5b2c1, dereferenced while it's still nullptr. Coverity-Id: 475552 Coverity-Id: 475551 Coverity-Id: 475550 Coverity-Id: 475549 Coverity-Id: 396828 Pick-to: 6.9 6.8 6.5 Change-Id: I1f9a8b93871143b420b9c8f247e49d57510a2379 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 6dcd11ef74a..83e38184936 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -843,14 +843,8 @@ struct QWidgetExceptionCleaner
\sa windowFlags
*/
QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
- : QObject(*new QWidgetPrivate, nullptr), QPaintDevice()
+ : QWidget(*new QWidgetPrivate, parent, f)
{
- QT_TRY {
- d_func()->init(parent, f);
- } QT_CATCH(...) {
- QWidgetExceptionCleaner::cleanup(this, d_func());
- QT_RETHROW;
- }
}