[Spice-devel] [PATCH spice] spicec-x11: Add a few missing XLockDisplay calls (rhbz#54265)

Alon Levy alevy at redhat.com
Thu Nov 18 00:32:21 PST 2010


Looks pretty harmless, but that's from someone not even sure what XIM is (input management?).

Did you just miss these calls when doing the XLockDisplay addition before?

On Wed, Nov 17, 2010 at 12:30:46PM +0100, Hans de Goede wrote:
> 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list