diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-05-14 14:10:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-15 20:44:36 +0200 |
commit | 44724508c97445e308eb86b6e193ed50da13caee (patch) | |
tree | 7a06b0806bd29cef39d3b2320e472fdac35e1d02 /src/widgets | |
parent | 77b179689ba37dc909778fdd00df2701f83a2868 (diff) |
Restore the QEvent::d pointer to null after we're done using it
Change-Id: I2fd6ebd80bf47456d74e939d49bff4ac9f199e8b
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 3629341d9e..17212ba08d 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -271,6 +271,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include <QtCore/qdatetime.h> #include <QtCore/qdebug.h> #include <QtCore/qmath.h> +#include <QtCore/qscopedvaluerollback.h> #include <QtWidgets/qapplication.h> #include <QtWidgets/qdesktopwidget.h> #include <QtGui/qevent.h> @@ -2777,7 +2778,7 @@ bool QGraphicsView::viewportEvent(QEvent *event) QApplication::sendEvent(d->scene, &windowDeactivate); } break; - case QEvent::Leave: + case QEvent::Leave: { // ### This is a temporary fix for until we get proper mouse grab // events. activeMouseGrabberItem should be set to 0 if we lose the // mouse grab. @@ -2790,9 +2791,11 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->useLastMouseEvent = false; // a hack to pass a viewport pointer to the scene inside the leave event Q_ASSERT(event->d == 0); + QScopedValueRollback<QEventPrivate *> rb(event->d); event->d = reinterpret_cast<QEventPrivate *>(viewport()); QApplication::sendEvent(d->scene, event); break; + } #ifndef QT_NO_TOOLTIP case QEvent::ToolTip: { QHelpEvent *toolTip = static_cast<QHelpEvent *>(event); |