Go to file
Gabriel de Dietrich ce37467acf Acknowledge QWidgetWindow::widget() may be null
We guard QWidgetWindow's widget with a QPointer to avoid
sending it events during destruction (which may result in
undefined behavior, since this originates from ~QObject and
we expect the object to behave as a QWidget). Therefore, we
need to harden all access to that widget since it can now
be null, specially during destruction.

As an example, QGestureManager may crash when we delete a
top-level widget. The crash stack trace is:

1  QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::data() const
2  QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::pointer qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>>(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>> const&)
3  QWidget::d_func()
4  QGestureManager::filterEvent(QWidget *, QEvent *)  <-- the widget ptr is null
5  QGestureManager::filterEvent(QObject *, QEvent *)
6  QApplication::notify(QObject *, QEvent *)
7  QCoreApplication::notifyInternal2(QObject *, QEvent *)
8  QCoreApplication::sendEvent(QObject *, QEvent *)
9  QWindow::destroy()
10 QWidgetPrivate::deleteTLSysExtra()
11 QWidgetPrivate::deleteExtra()
12 QWidgetPrivate::~QWidgetPrivate()
13 QWidgetPrivate::~QWidgetPrivate()
14 QWidgetPrivate::~QWidgetPrivate()
15 QScopedPointerDeleter<QObjectData>::cleanup(QObjectData *)
16 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::~QScopedPointer()
17 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::~QScopedPointer()
18 QObject::~QObject()
19 QWidget::~QWidget()

Task-number: QTBUG-53103
Change-Id: I1bb32648270c4f7791f668b8f0b639ddb4235703
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-10 18:32:49 +00:00
bin Fix syncqt.pl not respecting #pragma qt_no_master_include in files with Windows line endings 2016-02-25 16:25:37 +00:00
config.tests compile.text: Split huge line into multiple 2016-04-19 18:17:40 +00:00
dist Add changelog for 5.6.0 2016-03-01 11:23:43 +00:00
doc Doc: Simple offline CSS: Remove font-size declarations 2016-04-05 07:20:11 +00:00
examples fix example installs 2016-05-03 10:25:33 +00:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs automate the installation of some more example source files 2016-05-03 10:25:14 +00:00
qmake add some missing filename expandos to extra compilers 2016-05-02 18:34:59 +00:00
src Acknowledge QWidgetWindow::widget() may be null 2016-05-10 18:32:49 +00:00
tests decruft project files 2016-05-10 11:12:04 +00:00
tools Change some QNX defaults 2016-05-03 04:29:54 +00:00
util Don't use QStringLiteral in comparisons 2016-01-28 18:00:47 +00:00
.gitattributes Update the git-archive export options 2012-09-07 15:39:31 +02:00
.gitignore normalize structure of plugandpaint example 2016-05-03 10:25:18 +00:00
.qmake.conf Bump version 2016-02-18 07:38:22 +00:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
configure Ensure -no-pch is effective 2016-05-05 03:30:16 +00:00
configure.bat Move the official Qt version from qglobal.h to .qmake.conf 2015-10-14 20:12:57 +00:00
header.BSD Updated BSD licensed file headers 2015-02-15 07:41:17 +00:00
header.COMM Add header template for commercial only modules 2015-10-19 10:37:18 +00:00
header.FDL Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3-COMM Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL21 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL-ONLY Update copyright headers 2015-02-11 06:49:51 +00:00
INSTALL Doc: Update links in INSTALL file 2015-02-16 09:06:41 +00:00
LGPL_EXCEPTION.txt Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPLv3 fix up license references 2015-08-13 11:13:09 +00:00
LICENSE.LGPLv3 Bump copyright year to 2016 2016-01-29 13:30:04 +00:00
LICENSE.LGPLv21 Bump copyright year to 2016 2016-01-29 13:30:04 +00:00
LICENSE.PREVIEW.COMMERCIAL Update copyright headers 2015-02-11 06:49:51 +00:00
qtbase.pro Install fixqt4headers.pl script 2015-11-14 12:46:50 +00:00
sync.profile make a proper header-only module for QtZlib 2015-11-17 20:22:17 +00:00