Fix crash when 2+ screens are connected but not all are active in X11

When not all connected screens are active XRRGetCrtcInfo returns NULL
for the inactive screens resulting in a SIGSEGV when trying to push it
to the screens vector.
This commit is contained in:
Phantasm 2023-07-01 21:22:46 +02:00
parent af72b8163b
commit 1457d0b4c1
No known key found for this signature in database
GPG Key ID: 2669E588BCC634C8
2 changed files with 7 additions and 1 deletions

View File

@ -155,6 +155,9 @@ namespace WallpaperEngine::Render::Drivers::Detectors
XRRCrtcInfo* crtc = XRRGetCrtcInfo (this->m_display, screenResources, info->crtc);
if (crtc == nullptr)
continue;
// add the screen to the list of screens
this->m_screens.push_back (
{
@ -178,4 +181,4 @@ namespace WallpaperEngine::Render::Drivers::Detectors
this->m_display = nullptr;
}
}
}

View File

@ -136,6 +136,9 @@ void CX11Output::loadScreenInfo ()
XRRCrtcInfo* crtc = XRRGetCrtcInfo (this->m_display, screenResources, info->crtc);
if (crtc == nullptr)
continue;
// add the screen to the list of screens
this->m_screens.push_back (
new CX11OutputViewport