diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-06-07 15:04:55 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-06-07 15:50:54 +0200 |
commit | 779e1aaa352ff7a11b4ea51e3247477e1dfa16b4 (patch) | |
tree | cfcc2dcc4938ace554fc3b002a219adfe77c9205 /src/gui | |
parent | 689ac3631dee2cf83702584f13c96cd4281262a9 (diff) |
Protect against deleted windows
Check that the window is still there before
trying to deliver an event to it.
Reviewed-by: Samuel
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index bc4d2e3905..e04068e626 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -472,6 +472,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) { + if (!e->window) + return; + QEvent::Type type; // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; @@ -541,6 +544,9 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { + if (!e->window) + return; + QPoint globalPoint = e->globalPos; qt_last_x = globalPoint.x(); @@ -580,18 +586,27 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) { + if (!e->enter) + return; + QEvent event(QEvent::Enter); QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event); } void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e) { + if (!e->leave) + return; + QEvent event(QEvent::Leave); QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); } void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) { + if (!e->activated) + return; + QWindow *previous = QGuiApplicationPrivate::active_window; QGuiApplicationPrivate::active_window = e->activated.data(); if (self) @@ -670,18 +685,27 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange( void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e) { + if (!e->mapped) + return; + QEvent event(QEvent::Map); QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event); } void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e) { + if (!e->unmapped) + return; + QEvent event(QEvent::Unmap); QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event); } void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) { + if (!e->exposed) + return; + QExposeEvent event(e->region); QCoreApplication::sendSpontaneousEvent(e->exposed.data(), &event); } |