From b17c9c4dedf09873b10b3c23d5f189aa9eba6978 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Thu, 16 Oct 2014 14:53:17 +0100 Subject: Don't use MIT-SHM on remote displays. When run from within 'ssh -X' or 'ssh -Y', MIT-SHM will appear to be available even though it won't work: the shared memory will be on the machine running vncviewer, not on the machine running the X server it displays to. Depending on what shm segments are available on the machine running the X server, the failure may not be apparent when checking that MIT-SHM works. Avoid this by not using MIT-SHM when XDisplayName() indicates we may not be running locally. Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1072733 --- vncviewer/X11PixelBuffer.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vncviewer') diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx index 59b90e2c..f83aa5f4 100644 --- a/vncviewer/X11PixelBuffer.cxx +++ b/vncviewer/X11PixelBuffer.cxx @@ -156,6 +156,11 @@ int X11PixelBuffer::setupShm() Bool pixmaps; XErrorHandler old_handler; Status status; + const char *display_name = XDisplayName (NULL); + + /* Don't use MIT-SHM on remote displays */ + if (*display_name && *display_name != ':') + return 0; if (!XShmQueryVersion(fl_display, &major, &minor, &pixmaps)) return 0; -- cgit v1.2.3