[Spice-devel] [PATCH spice 2/4] spicec-x11: Add missing XLockDisplay around XRRSetCrtcConfig

Hans de Goede hdegoede at redhat.com
Sun Oct 17 02:46:18 PDT 2010


XRRSetCrtcConfig waits for an XReply, so add a missing XLockDisplay,
this fixes a hang (due to a race so not always) when switching between
windowed and fullscreen mode.
---
 client/x11/platform.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 0642922..645c929 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -2150,8 +2150,10 @@ void XMonitor::disable()
     if (!res.valid()) {
         THROW("get screen resources failed");
     }
+    XLockDisplay(display);
     XRRSetCrtcConfig(display, res.get(), _crtc, CurrentTime,
                      0, 0, None, RR_Rotate_0, NULL, 0);
+    XUnlockDisplay(display);
 
     XMonitorsList::iterator iter = _clones.begin();
     for (; iter != _clones.end(); iter++) {
@@ -2174,10 +2176,12 @@ void XMonitor::enable()
     if (!res.valid()) {
         THROW("get screen resources failed");
     }
+    XLockDisplay(display);
     XRRSetCrtcConfig(display, res.get(), _crtc, CurrentTime,
                      _position.x, _position.y,
                      _mode, _rotation,
                      _outputs, _noutput);
+    XUnlockDisplay(display);
 
     XMonitorsList::iterator iter = _clones.begin();
     for (; iter != _clones.end(); iter++) {
-- 
1.7.3.1



More information about the Spice-devel mailing list