summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLouai Al-Khanji <louai.al-khanji@digia.com>2014-10-02 09:19:12 +0300
committerLouai Al-Khanji <louai.al-khanji@digia.com>2014-10-03 07:44:39 +0200
commitb1cbc1289ffd36c6ac30b049b8f5f8730ee4889d (patch)
tree8896d73bed7186bbf1bbfb5f376f9d0d2f8ab8dc /src
parentd5576b1cb8422e38716c99aab34622b5dc23437c (diff)
EGLFS: Fix plugin destruction (again)
The previous patch was flawed since by the time the QEglPlatformIntegration destructor was called the virtual function table did not point to the methods in QEglFsPlatformIntegration any more. Change-Id: I310e5e3e734a22b44645ba912b579f193bcfae86 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp10
-rw-r--r--src/gui/kernel/qplatformintegration.h1
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration.cpp14
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp1
6 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 79dd7ea9348..520330abc1e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1391,6 +1391,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
}
#endif
+ platform_integration->destroy();
+
delete platform_theme;
platform_theme = 0;
delete platform_integration;
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 39b031ef6d2..7e291e90507 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -324,6 +324,16 @@ void QPlatformIntegration::initialize()
}
/*!
+ Called before the platform integration is deleted. Useful when cleanup relies on virtual
+ functions.
+
+ \since 5.5
+*/
+void QPlatformIntegration::destroy()
+{
+}
+
+/*!
Returns the platforms input context.
The default implementation returns 0, implying no input method support.
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d510240fa48..ccbe4cc73dc 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -109,6 +109,7 @@ public:
// Event dispatcher:
virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
virtual void initialize();
+ virtual void destroy();
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
index a6207cf4023..10913ef0945 100644
--- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
@@ -95,15 +95,7 @@ QEGLPlatformIntegration::QEGLPlatformIntegration()
QEGLPlatformIntegration::~QEGLPlatformIntegration()
{
- foreach (QWindow *w, qGuiApp->topLevelWindows())
- w->destroy();
-
- delete m_screen;
-
- if (m_display != EGL_NO_DISPLAY)
- eglTerminate(m_display);
- destroy();
}
void QEGLPlatformIntegration::initialize()
@@ -126,7 +118,13 @@ void QEGLPlatformIntegration::initialize()
void QEGLPlatformIntegration::destroy()
{
+ foreach (QWindow *w, qGuiApp->topLevelWindows())
+ w->destroy();
+
+ delete m_screen;
+ if (m_display != EGL_NO_DISPLAY)
+ eglTerminate(m_display);
}
QAbstractEventDispatcher *QEGLPlatformIntegration::createEventDispatcher() const
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h
index 11977db78b7..2080ff03524 100644
--- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h
@@ -65,7 +65,7 @@ public:
~QEGLPlatformIntegration();
void initialize() Q_DECL_OVERRIDE;
- virtual void destroy();
+ void destroy() Q_DECL_OVERRIDE;
QEGLPlatformScreen *screen() const { return m_screen; }
EGLDisplay display() const { return m_display; }
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 16d8c502910..6fe38939225 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -88,6 +88,7 @@ void QEglFSIntegration::initialize()
void QEglFSIntegration::destroy()
{
+ QEGLPlatformIntegration::destroy();
QEglFSHooks::hooks()->platformDestroy();
}