summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>2012-04-02 14:34:36 -0700
committerQt by Nokia <qt-info@nokia.com>2012-04-03 10:45:02 +0200
commitf913859f88c5f032833f6eeb1c9c3066f4405a9a (patch)
tree0f965a886d806d9a9b4f48945811be931bffc858 /src/plugins
parentf578e5236359a88f3a89f529b54efac1df86ea76 (diff)
eglfs: delete screen on exit
Delete the screen when the integration gets deleted. The screen destructor destroys the window surface and terminates the egl connection. Note that the egl context is not destroyed since it is managed by QOpenGLContext. Change-Id: Ifb91c20edb6d5db684c37fb84d5ff40436f40925 Reviewed-by: Donald Carr <donald.carr@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp9
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp8
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h2
4 files changed, 18 insertions, 3 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index d180de349e..ef889cd70d 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -57,15 +57,20 @@
QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
- : mFontDb(new QGenericUnixFontDatabase())
+ : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QEglFSScreen(EGL_DEFAULT_DISPLAY))
{
- screenAdded(new QEglFSScreen(EGL_DEFAULT_DISPLAY));
+ screenAdded(mScreen);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration\n");
#endif
}
+QEglFSIntegration::~QEglFSIntegration()
+{
+ delete mScreen;
+}
+
bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index 73866b6997..eea36a489d 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -55,6 +55,7 @@ class QEglFSIntegration : public QPlatformIntegration
{
public:
QEglFSIntegration();
+ ~QEglFSIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
@@ -70,6 +71,7 @@ public:
private:
QPlatformFontDatabase *mFontDb;
+ QPlatformScreen *mScreen;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 000bedf293..fdffd96d6e 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -146,6 +146,14 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
eglSwapInterval(m_dpy, swapInterval);
}
+QEglFSScreen::~QEglFSScreen()
+{
+ if (m_surface)
+ eglDestroySurface(m_dpy, m_surface);
+
+ eglTerminate(m_dpy);
+}
+
void QEglFSScreen::createAndSetPlatformContext() const {
const_cast<QEglFSScreen *>(this)->createAndSetPlatformContext();
}
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index 5ec187366b..30ef55f13f 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -56,7 +56,7 @@ class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to f
{
public:
QEglFSScreen(EGLNativeDisplayType display);
- ~QEglFSScreen() {}
+ ~QEglFSScreen();
QRect geometry() const;
int depth() const;