File: 1005_check_XOpenDisplay.patch

package info (click to toggle)
qtsystems-opensource-src 5.0~git20230712.81e08ee%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 5,468 kB
  • sloc: cpp: 31,668; xml: 1,648; javascript: 372; makefile: 41; sh: 2
file content (24 lines) | stat: -rw-r--r-- 925 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Author: Guido Berhoerster <guido+debian@berhoerster.name>
Description: Check the return value of XOpenDisplay and handle failure
--- qtsystems.orig/src/systeminfo/linux/qscreensaver_linux.cpp
+++ qtsystems/src/systeminfo/linux/qscreensaver_linux.cpp
@@ -58,6 +58,9 @@ bool QScreenSaverPrivate::screenSaverEna
     int preferBlanking = 0;
     int allowExposures = 0;
     Display *display = XOpenDisplay(0);
+    if (!display) {
+        return false;
+    }
     XGetScreenSaver(display, &timeout, &interval, &preferBlanking, &allowExposures);
     XCloseDisplay(display);
     return (timeout > 0);
@@ -74,6 +77,9 @@ void QScreenSaverPrivate::setScreenSaver
     int preferBlanking = 0;
     int allowExposures = 0;
     Display *display = XOpenDisplay(0);
+    if (!display) {
+        return;
+    }
     XGetScreenSaver(display, &timeout, &interval, &preferBlanking, &allowExposures);
 
     if (enabled && timeout > 0)