From 91e236022acd79dfbc4aef9e30edb4d1aeb2685c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 4 Feb 2010 14:15:56 +0100 Subject: Flush the WSERV command buffer after deleting a surface. For graphics systems that use EGL surfaces in the backing store destroying the surface does not guarantee that the memory is immediately freed because this command does not cause a flush. This implies that a manual flush is instead needed. We do this in 2 places; the first is when the surface is destroyed due to a visibility changed. The second case is just after the window has been destroyed. At this point the backing store has already been deleted so the deletion of both the surface and window can happen atomically in WSERV. Task-number: QT-2506 Reviewed-by: Iain --- src/gui/kernel/qapplication_s60.cpp | 3 +++ src/gui/kernel/qwidget_s60.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6caac9f..6e03d7c 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1647,6 +1647,9 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { delete w->d_func()->topData()->backingStore; w->d_func()->topData()->backingStore = 0; + // In order to ensure that any resources used by the window surface + // are immediately freed, we flush the WSERV command buffer. + S60->wsSession().Flush(); } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) && !w->d_func()->maybeBackingStore()) { w->d_func()->topData()->backingStore = new QWidgetBackingStore(w); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 00f2213..0ce7534 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1195,6 +1195,10 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (destroyWindow) { delete id; + // At this point the backing store should already be destroyed + // so we flush the command buffer to ensure that the freeing of + // those resources and deleting the window can happen "atomically" + S60->wsSession().Flush(); } } -- cgit v0.12