From a39e37100a86aa64a6463c36d5a6444df01ec169 Mon Sep 17 00:00:00 2001
From: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Date: Fri, 3 Feb 2012 10:30:40 +0200
Subject: [PATCH] Set pointer focus to null when surface is destroyed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We must do something otherwise the next inputDevice->mouseFocus() call
will dereference an already deleted instance.

Change-Id: I3ac92a37715f63c6dc43191968a8da51befbccde
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
---
 src/compositor/wayland_wrapper/wlcompositor.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp
index 830cb296..b28f8f8b 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/wlcompositor.cpp
@@ -248,6 +248,8 @@ void Compositor::processWaylandEvents()
 
 void Compositor::surfaceDestroyed(Surface *surface)
 {
+    if (defaultInputDevice()->mouseFocus() == surface)
+        defaultInputDevice()->setMouseFocus(0, QPoint(), QPoint());
     m_surfaces.removeOne(surface);
     m_dirty_surfaces.remove(surface);
     if (m_directRenderSurface == surface)
-- 
GitLab