path: root/src/gui/kernel/qpaintdevicewindow.cpp
diff options
authorLaszlo Agocs <>2014-08-06 10:23:43 +0200
committerLaszlo Agocs <>2014-08-07 09:03:59 +0200
commit37023a096d5fec6937bca25047973a05041db66f (patch)
treedea33d5ee214410ad38f70db17cd431452490af3 /src/gui/kernel/qpaintdevicewindow.cpp
parent4ff12977d820d817ea235c6fea3a7441ec19b80a (diff)
Avoid repaints and swapbuffers when the platform window is already gone
On Linux at least the qopenglwindow example sometimes shows "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined" when closing the window and exiting the application. This patch avoids this by not triggering repaints anymore when the platform window is destroyed. Change-Id: I54bd41e5c1471f7cdfec89f8ec3be48d1438be39 Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'src/gui/kernel/qpaintdevicewindow.cpp')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index 232e8b5d6d..9c6a255ca7 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -188,7 +188,8 @@ bool QPaintDeviceWindow::event(QEvent *event)
if (event->type() == QEvent::UpdateRequest) {
d->paintEventSent = false;
- d->handleUpdateEvent();
+ if (handle()) // platform window may be gone when the window is closed during app exit
+ d->handleUpdateEvent();
return true;