Introduce QWindowSystemInterface::handleSynchronousCloseEvent
authorGunnar Sletta <gunnar.sletta@nokia.com>
Fri, 25 Nov 2011 13:02:12 +0000 (14:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 25 Nov 2011 13:44:39 +0000 (14:44 +0100)
And use it from the Cocoa backend.

In general, for threaded GL rendering to work, any function that
affect the surface must be synchronous, so the implementor (such as
QQuickCanvas) can pick it up and block until the GL context has
released the surface. Otherwise, we will crash.

Change-Id: Id8484dac7452fe96fa80ade4ea321145f32124b4
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/kernel/qwindowsysteminterface_qpa.cpp
src/gui/kernel/qwindowsysteminterface_qpa.h
src/plugins/platforms/cocoa/qcocoawindow.mm

index 4a704d8..17a5bb4 100644 (file)
@@ -108,6 +108,14 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *tlw)
     }
 }
 
+void QWindowSystemInterface::handleSynchronousCloseEvent(QWindow *tlw)
+{
+    if (tlw) {
+        QWindowSystemInterfacePrivate::CloseEvent e(tlw);
+        QGuiApplicationPrivate::processWindowSystemEvent(&e);
+    }
+}
+
 /*!
 
 \a tlw == 0 means that \a ev is in global coords only
index 7102a0f..04e8a6e 100644 (file)
@@ -98,6 +98,7 @@ public:
     static void handleGeometryChange(QWindow *w, const QRect &newRect);
     static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect);
     static void handleCloseEvent(QWindow *w);
+    static void handleSynchronousCloseEvent(QWindow *w);
     static void handleEnterEvent(QWindow *w);
     static void handleLeaveEvent(QWindow *w);
     static void handleWindowActivated(QWindow *w);
index 9caade6..de38db5 100644 (file)
@@ -233,7 +233,7 @@ void QCocoaWindow::windowDidResize()
 
 void QCocoaWindow::windowWillClose()
 {
-    QWindowSystemInterface::handleCloseEvent(window());
+    QWindowSystemInterface::handleSynchronousCloseEvent(window());
 }
 
 void QCocoaWindow::setCurrentContext(QCocoaGLContext *context)