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.
This commit is contained in:
Vlad Zahorodnii 2020-12-02 14:12:56 +02:00
parent 932cd27a5c
commit b94c876597
7 changed files with 19 additions and 3 deletions

View file

@ -42,9 +42,6 @@ Platform::Platform(QObject *parent)
Platform::~Platform()
{
if (m_eglDisplay != EGL_NO_DISPLAY) {
eglTerminate(m_eglDisplay);
}
}
PlatformCursorImage Platform::cursorImage() const

View file

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

View file

@ -147,6 +147,9 @@ HwcomposerBackend::~HwcomposerBackend()
if (!m_outputBlank) {
toggleBlankOutput();
}
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
}
void HwcomposerBackend::init()

View file

@ -42,6 +42,9 @@ VirtualBackend::VirtualBackend(QObject *parent)
VirtualBackend::~VirtualBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
}
void VirtualBackend::init()

View file

@ -462,6 +462,10 @@ WaylandBackend::WaylandBackend(QObject *parent)
WaylandBackend::~WaylandBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
if (m_pointerConstraints) {
m_pointerConstraints->release();
}

View file

@ -73,6 +73,9 @@ X11StandalonePlatform::~X11StandalonePlatform()
m_openGLFreezeProtectionThread->wait();
delete m_openGLFreezeProtectionThread;
}
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
}
if (isReady()) {
XRenderUtils::cleanup();
}

View file

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