summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-15 15:52:25 +0200
committerSimon Rettberg2021-04-15 15:52:25 +0200
commit3ade930ff190bce05e75ed86e8d0eaae26644307 (patch)
treeebdbba366bc6df09b968ca50156b84947e85b4e3 /src
parentDon't make the return key press the Cancel button... (diff)
downloadprintergui-3ade930ff190bce05e75ed86e8d0eaae26644307.tar.gz
printergui-3ade930ff190bce05e75ed86e8d0eaae26644307.tar.xz
printergui-3ade930ff190bce05e75ed86e8d0eaae26644307.zip
Fix Display handle leak
Diffstat (limited to 'src')
-rw-r--r--src/x11workaround.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/x11workaround.cpp b/src/x11workaround.cpp
index c093362..3554963 100644
--- a/src/x11workaround.cpp
+++ b/src/x11workaround.cpp
@@ -6,6 +6,8 @@ void movePointer(int x, int y) {
int root_x, root_y, win_x, win_y;
unsigned int mask_return;
Display* dpy = XOpenDisplay(0);
+ if (dpy == nullptr)
+ return;
Window root = DefaultRootWindow(dpy);
Window window_returned;
result = XQueryPointer(dpy, root, &window_returned, &window_returned, &root_x, &root_y, &win_x, &win_y, &mask_return);
@@ -15,6 +17,7 @@ void movePointer(int x, int y) {
}
XWarpPointer(dpy, None,root, 0, 0, 0, 0, root_x - x ,root_y - y);
XFlush(dpy);
+ XCloseDisplay(dpy);
}
void wiggle() {