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>
bb10
Louai Al-Khanji 2014-10-02 09:19:12 +03:00
parent d5576b1cb8
commit b1cbc1289f
6 changed files with 21 additions and 9 deletions

View File

@ -1391,6 +1391,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
}
#endif
platform_integration->destroy();
delete platform_theme;
platform_theme = 0;
delete platform_integration;

View File

@ -323,6 +323,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.

View File

@ -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;

View File

@ -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

View File

@ -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; }

View File

@ -88,6 +88,7 @@ void QEglFSIntegration::initialize()
void QEglFSIntegration::destroy()
{
QEGLPlatformIntegration::destroy();
QEglFSHooks::hooks()->platformDestroy();
}