summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-07-28 20:13:26 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-07-28 20:22:20 (GMT)
commit4caf5c1568163aa8efbfabb69ef0d83c3c6efd0a (patch)
tree8b17de2ad430d79726258fbeae3723b9e71b69b2 /src/plugins/gfxdrivers
parenta1c4e70ddb04e364d89bfd39a409c4bcbe0019e4 (diff)
downloadQt-4caf5c1568163aa8efbfabb69ef0d83c3c6efd0a.zip
Qt-4caf5c1568163aa8efbfabb69ef0d83c3c6efd0a.tar.gz
Qt-4caf5c1568163aa8efbfabb69ef0d83c3c6efd0a.tar.bz2
Fix crash in when resizing directfb windows
Since QRasterPaintEngine::baseClip was initialized when the QDirectFBPaintEngine was created and the paintengine persists for the window surface we run the risk that the baseClip is of the wrong size. This could lead to crashes and erroneous clipping. Reviewed-by: Donald <qt-info@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp15
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h1
2 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index a1009ac..15a46d7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -56,6 +56,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
, dfbWindow(0)
#endif
, engine(0)
+ , engineHeight(-1)
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
{
@@ -77,6 +78,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
, dfbWindow(0)
#endif
, engine(0)
+ , engineHeight(-1)
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
{
@@ -295,11 +297,8 @@ bool QDirectFBWindowSurface::move(const QPoint &moveBy)
QPaintEngine *QDirectFBWindowSurface::paintEngine() const
{
- if (!engine) {
- QDirectFBWindowSurface *that = const_cast<QDirectFBWindowSurface*>(this);
- that->engine = new QDirectFBPaintEngine(that);
- return that->engine;
- }
+ Q_ASSERT(engine);
+ Q_ASSERT(height() <= engineHeight);
return engine;
}
@@ -427,6 +426,12 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
void QDirectFBWindowSurface::beginPaint(const QRegion &)
{
+ const int h = height();
+ if (h > engineHeight) {
+ engineHeight = h;
+ delete engine;
+ engine = new QDirectFBPaintEngine(this);
+ }
}
void QDirectFBWindowSurface::endPaint(const QRegion &)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index c46d93b..cd88aca 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -93,6 +93,7 @@ private:
IDirectFBWindow *dfbWindow;
#endif
QDirectFBPaintEngine *engine;
+ int engineHeight;
enum Mode {
Primary,