[spice/f14/master] - Fix spice client locking up when dealing with XIM input (#654265)

Hans de Goede jwrdegoede at fedoraproject.org
Thu Nov 25 11:17:10 UTC 2010


commit 0d250330e98d8554be1f6f0985932aed0c684c65
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Nov 17 12:33:17 2010 +0100

    - Fix spice client locking up when dealing with XIM input (#654265)

 ...Add-a-few-missing-XLockDisplay-calls-rhbz.patch |   48 ++++++++++++++++++++
 spice.spec                                         |    7 +++-
 2 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/0007-spicec-x11-Add-a-few-missing-XLockDisplay-calls-rhbz.patch b/0007-spicec-x11-Add-a-few-missing-XLockDisplay-calls-rhbz.patch
new file mode 100644
index 0000000..7cbc8cb
--- /dev/null
+++ b/0007-spicec-x11-Add-a-few-missing-XLockDisplay-calls-rhbz.patch
@@ -0,0 +1,48 @@
+From 084225fda75be2bead6e2dad313b9e861d93bffc Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 17 Nov 2010 12:19:41 +0100
+Subject: [PATCH spice] spicec-x11: Add a few missing XLockDisplay calls (rhbz#654265)
+
+The XIM functions end up waiting for a reply from the server, so they
+need locking around them. Idem for the XLookupString call.
+---
+ client/x11/red_window.cpp |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
+index c3ee1b0..c50e307 100644
+--- a/client/x11/red_window.cpp
++++ b/client/x11/red_window.cpp
+@@ -733,7 +733,9 @@ void RedWindow_p::handle_key_press_event(RedWindow& window, XKeyEvent* event)
+ 
+     if (x_input_context != NULL) {
+         for (;;) {
++            XLockDisplay(x_display);
+             len = XwcLookupString(x_input_context, event, utf32_buf, buf_size, &key_sym, &status);
++            XUnlockDisplay(x_display);
+             if (status != XBufferOverflow) {
+                 break;
+             }
+@@ -767,7 +769,9 @@ void RedWindow_p::handle_key_press_event(RedWindow& window, XKeyEvent* event)
+         unsigned char buffer[16];
+         int i;
+ 
++        XLockDisplay(x_display);
+         len = XLookupString(event, (char *)buffer, sizeof(buffer), NULL, NULL);
++        XUnlockDisplay(x_display);
+         for (i = 0; i < len; i++) {
+             window.get_listener().on_char((uint32_t)buffer[i]);
+         }
+@@ -2135,7 +2139,9 @@ void RedWindow::on_focus_in()
+     }
+     _focused = true;
+     if (x_input_context) {
++        XLockDisplay(x_display);
+         XwcResetIC(x_input_context);
++        XUnlockDisplay(x_display);
+     }
+     XPlatform::on_focus_in();
+     get_listener().on_activate();
+-- 
+1.7.3.2
+
diff --git a/spice.spec b/spice.spec
index a7449fc..739146b 100644
--- a/spice.spec
+++ b/spice.spec
@@ -1,6 +1,6 @@
 Name:           spice
 Version:        0.6.3
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Implements the SPICE protocol
 Group:          User Interface/Desktops
 License:        LGPLv2+
@@ -13,6 +13,7 @@ Patch3:         0003-Remove-no-longer-used-wstring_printf-functions.patch
 Patch4:         0004-spicec-x11-Do-not-set-_NET_WM_USER_TIME-to-0-on-star.patch
 Patch5:         0005-spicec-x11-Listen-for-selection-owner-window-destroy.patch
 Patch6:         0006-spicec-Make-cegui-log-to-app_data_dir-cegui.log.patch
+Patch7:         0007-spicec-x11-Add-a-few-missing-XLockDisplay-calls-rhbz.patch
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=613529
 ExclusiveArch:  i686 x86_64
@@ -76,6 +77,7 @@ using spice-server, you will need to install spice-server-devel.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 %build
 %configure --enable-gui
@@ -118,6 +120,9 @@ rm -f %{buildroot}%{_libdir}/libspice-server.la
 %endif
 
 %changelog
+* Wed Nov 17 2010 Hans de Goede <hdegoede at redhat.com> - 0.6.3-4
+- Fix spice client locking up when dealing with XIM input (#654265)
+
 * Sat Nov  6 2010 Hans de Goede <hdegoede at redhat.com> - 0.6.3-3
 - Log to ~/.spicec/cegui.log rather then to CEGUI.log in the cwd, this
   fixes spicec from aborting when run in a non writable dir (#650253)


More information about the scm-commits mailing list