summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-09-02 20:13:36 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-09-02 21:49:50 (GMT)
commit6ce20b8d0fbee2f32c892943c80c3ed9aef2f866 (patch)
tree118d7e3c4a48be9e75a4341d4f18ff9e2c97ad29 /src
parent794c71cd5eb7fc976b8f203c4d56a9567933dd9f (diff)
downloadQt-6ce20b8d0fbee2f32c892943c80c3ed9aef2f866.zip
Qt-6ce20b8d0fbee2f32c892943c80c3ed9aef2f866.tar.gz
Qt-6ce20b8d0fbee2f32c892943c80c3ed9aef2f866.tar.bz2
Make sure to release surface in ~DFBWindowSurface
We don't want this surface to be released by QDirectFBScreen. It's always created without tracking. Also abstract the if (dfbSurface != primarySurface) things since we will use it from multiple functions. Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp20
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index e288199..7abba81 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -100,6 +100,8 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
+ releaseSurface();
+ // these are not tracked by QDirectFBScreen so we don't want QDirectFBPaintDevice to release it
}
bool QDirectFBWindowSurface::isValid() const
@@ -454,6 +456,24 @@ void QDirectFBWindowSurface::updateFormat()
imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
}
+void QDirectFBWindowSurface::releaseSurface()
+{
+ if (dfbSurface) {
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlgs)
+ unlockSurface();
+#endif
+#ifdef QT_NO_DIRECTFB_WM
+ Q_ASSERT(screen->primarySurface());
+ if (dfbSurface != screen->primarySurface())
+#endif
+
+ dfbSurface->Release(dfbSurface);
+ dfbSurface = 0;
+ }
+}
+
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index ca76613..edecb14 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -95,6 +95,7 @@ public:
IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ void releaseSurface();
QDirectFBWindowSurface *sibling;
#ifdef QT_DIRECTFB_WM