Skip to content
Permalink
Browse files

Fix crash on Linux when trying to configure shortcuts.

Trying to set a push-to-talk key Xlib functions were
called before the display and thus Xlib functions being
initialized, leading to a crash concerning /dev/input.
Debug output:

 #0  XKeycodeToKeysym (dpy=0x0, kc=50 '2', col=0) at ../../../src/xkb/XKBBind.c:111

This patch calls XOpenDisplay() earlier to avoid this.

Fixes #1250
  • Loading branch information...
wijnen authored and hacst committed Oct 19, 2014
1 parent 54ec595 commit dc87fa239cd5491e8685214457852a3dc522238a
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/mumble/GlobalShortcut_unix.cpp
@@ -47,7 +47,12 @@ GlobalShortcutX::GlobalShortcutX() {
iXIopcode = -1;
bRunning = false;

display = NULL;
display = XOpenDisplay(NULL);

if (! display) {
qWarning("GlobalShortcutX: Unable to open dedicated display connection.");
return;
}

#ifdef Q_OS_LINUX
QString dir = QLatin1String("/dev/input");
@@ -67,13 +72,6 @@ GlobalShortcutX::GlobalShortcutX() {
}
#endif

display = XOpenDisplay(NULL);

if (! display) {
qWarning("GlobalShortcutX: Unable to open dedicated display connection.");
return;
}

for (int i=0; i < ScreenCount(display); ++i)
qsRootWindows.insert(RootWindow(display, i));

0 comments on commit dc87fa2

Please sign in to comment.
You can’t perform that action at this time.