summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qlabel.h
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins@kdab.com>2018-03-02 18:36:20 +0000
committerSérgio Martins <sergio.martins@kdab.com>2018-03-08 22:36:49 +0000
commitc082d84d5d7fdbfb64de18f06a8ddbc77f2e6de4 (patch)
tree1d881e4d7610fb0f5d94ac6b8f586886c45db46b /src/widgets/widgets/qlabel.h
parente5a6e9bb80fb2427228f70488b8839b4aa0b4261 (diff)
Fix QLabel crash if buddy's lifetime is too short
If buddy is deleted then QLabel will still try to deliver the shortcut event to it, in QLabel::event(), and cras. Besides connecting to destroyed() which alone fixes the crash, also hardened it and guarded against dereferencing null buddy, in the unlikely event of someone adding features to QLabel. The second part is suitable for backporting to the LTS branches. Task-Id: QTBUG-66841 Change-Id: Ib6a36a9f99cee31afe1f88eb77f5b6cafb8b1086 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/widgets/qlabel.h')
-rw-r--r--src/widgets/widgets/qlabel.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index e1cc333a1c..2f5db5a7d3 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -158,6 +158,9 @@ private:
#endif
Q_PRIVATE_SLOT(d_func(), void _q_linkHovered(const QString &))
+#ifndef QT_NO_SHORTCUT
+ Q_PRIVATE_SLOT(d_func(), void _q_buddyDeleted())
+#endif
friend class QTipLabel;
friend class QMessageBoxPrivate;
friend class QBalloonTip;