summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h7
2 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 0f7a6de..00eeebd 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -99,8 +99,11 @@ public:
qint64 cursorImageKey;
QDirectFBScreen *q;
+ static QDirectFBScreen *instance;
};
+QDirectFBScreen *QDirectFBScreenPrivate::instance = 0;
+
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -802,13 +805,21 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
QDirectFBScreen::QDirectFBScreen(int display_id)
: QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this))
{
+ QDirectFBScreenPrivate::instance = this;
}
QDirectFBScreen::~QDirectFBScreen()
{
+ if (QDirectFBScreenPrivate::instance == this)
+ QDirectFBScreenPrivate::instance = 0;
delete d_ptr;
}
+QDirectFBScreen *QDirectFBScreen::instance()
+{
+ return QDirectFBScreenPrivate::instance;
+}
+
int QDirectFBScreen::depth(DFBSurfacePixelFormat format)
{
switch (format) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 5e8c5c6..437f1ae 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -163,12 +163,7 @@ public:
QWSWindowSurface *createSurface(QWidget *widget) const;
QWSWindowSurface *createSurface(const QString &key) const;
- static inline QDirectFBScreen *instance() {
- QScreen *inst = QScreen::instance();
- Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass);
- return static_cast<QDirectFBScreen*>(inst);
- }
-
+ static QDirectFBScreen *instance();
void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
#ifdef QT_DIRECTFB_SUBSURFACE