From a7542070ae5560aa0eb56260984da62cfb8fac08 Mon Sep 17 00:00:00 2001 From: Riteo Date: Thu, 11 May 2023 19:25:53 +0200 Subject: [PATCH] Check DBus loading status before attempting to detect its version Fixes two related segfaults caused by running the DBus version check unconditionally and potentially calling null function pointers. This was clearly an oversight as all the other wrappers have proper loading status checks. --- platform/linuxbsd/freedesktop_portal_desktop.cpp | 5 +++++ platform/linuxbsd/freedesktop_screensaver.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/platform/linuxbsd/freedesktop_portal_desktop.cpp b/platform/linuxbsd/freedesktop_portal_desktop.cpp index b45b7e676d..6dfa8ed93c 100644 --- a/platform/linuxbsd/freedesktop_portal_desktop.cpp +++ b/platform/linuxbsd/freedesktop_portal_desktop.cpp @@ -138,6 +138,11 @@ FreeDesktopPortalDesktop::FreeDesktopPortalDesktop() { #else unsupported = false; #endif + + if (unsupported) { + return; + } + bool ver_ok = false; int version_major = 0; int version_minor = 0; diff --git a/platform/linuxbsd/freedesktop_screensaver.cpp b/platform/linuxbsd/freedesktop_screensaver.cpp index 78f2337599..cf179b5735 100644 --- a/platform/linuxbsd/freedesktop_screensaver.cpp +++ b/platform/linuxbsd/freedesktop_screensaver.cpp @@ -141,6 +141,11 @@ FreeDesktopScreenSaver::FreeDesktopScreenSaver() { #else unsupported = false; #endif + + if (unsupported) { + return; + } + bool ver_ok = false; int version_major = 0; int version_minor = 0;