Commit b94c8765 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

Fix crash in eglTerminate()

At the moment, the gbm_device for the primary device is destroyed before
the EGLDisplay is destroyed. This results in a crash in Mesa.

In order to fix the crash, this change ensures that the EGLDisplay is
destroyed before the gbm device.
parent 932cd27a
......@@ -42,9 +42,6 @@ Platform::Platform(QObject *parent)
Platform::~Platform()
{
if (m_eglDisplay != EGL_NO_DISPLAY) {
eglTerminate(m_eglDisplay);
}
}
PlatformCursorImage Platform::cursorImage() const
......
......@@ -57,6 +57,9 @@ DrmGpu::DrmGpu(DrmBackend *backend, QByteArray devNode, int fd, int drmId) : m_b
DrmGpu::~DrmGpu()
{
if (m_eglDisplay != EGL_NO_DISPLAY) {
eglTerminate(m_eglDisplay);
}
#if HAVE_GBM
gbm_device_destroy(m_gbmDevice);
#endif
......
......@@ -147,6 +147,9 @@ HwcomposerBackend::~HwcomposerBackend()
if (!m_outputBlank) {
toggleBlankOutput();
}
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
}
void HwcomposerBackend::init()
......
......@@ -42,6 +42,9 @@ VirtualBackend::VirtualBackend(QObject *parent)
VirtualBackend::~VirtualBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
}
void VirtualBackend::init()
......
......@@ -462,6 +462,10 @@ WaylandBackend::WaylandBackend(QObject *parent)
WaylandBackend::~WaylandBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
if (m_pointerConstraints) {
m_pointerConstraints->release();
}
......
......@@ -73,6 +73,9 @@ X11StandalonePlatform::~X11StandalonePlatform()
m_openGLFreezeProtectionThread->wait();
delete m_openGLFreezeProtectionThread;
}
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
if (isReady()) {
XRenderUtils::cleanup();
}
......
......@@ -49,6 +49,9 @@ X11WindowedBackend::X11WindowedBackend(QObject *parent)
X11WindowedBackend::~X11WindowedBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
if (m_connection) {
if (m_keySymbols) {
xcb_key_symbols_free(m_keySymbols);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment