Marc Mutz 96aa7232c7 QFontDialog: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QFontDialog is UB.

Says UBSan:

  qfontdialog_p.h:43:5: runtime error: downcast of address 0x604000026b90 which does not point to an object of type 'QFontDialog'
  0x604000026b90: note: object is of type 'QDialog'
   00 00 00 00  30 a4 26 31 45 7f 00 00  80 b9 00 00 90 61 00 00  08 a6 26 31 45 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'
    #0 0x7f452ecad24d in QFontDialogPrivate::q_func() qfontdialog_p.h:43
    #1 0x7f452ecad24d in QFontDialogPrivate::setVisible(bool) qfontdialog.cpp:959
    #2 0x7f452ea2b5f5 in QDialog::setVisible(bool) qdialog.cpp:757
    #3 0x7f452c26d768 in QWidget::hide() qwidget.cpp:8179
    #4 0x7f452ea2ae09 in QDialog::~QDialog() qdialog.cpp:398

Fix by casting at most to QDialog* (QWidget* would actually have
sufficed).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: Ic1a63ff02b1a1435499a6980772b1b75236f31f7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 41480dbd4abadf13c26e487ae23ce681866b6af3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
2025-03-24 18:27:25 +00:00
2024-11-05 14:36:16 +01:00
2015-08-18 19:59:14 +00:00
2024-11-05 14:36:16 +01:00
2025-03-25 08:40:27 +00:00
2024-06-25 11:44:00 +02:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%