[Spice-commits] gtk/channel-main.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Thu Aug 28 14:02:57 PDT 2014

 gtk/channel-main.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit befd4f142a00fbef555560e542e9ed210c2960b7
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu Aug 28 10:35:41 2014 -0500

    Wait to send monitor config until agent caps are received
    When the first display is disabled and the vdagent is restarted in the guest,
    it sometimes becomes enabled. This appears to be caused by a race condition
    when an agent becomes connected. When the agent becomes connected, virt-viewer
    triggers a display update (spice_main_send_monitor_config()). This display
    update happens in a timeout handler, but the timeout interval is set to 0 (so
    it behaves basically like an idle handler).
    The race happens because spice_main_send_monitor_config() behaves slightly
    differently depending on the agent's capabilities. And sometimes the idle
    handler runs before the client and server have negotiated capabilities. In this
    case, we have to assume that the server does not support sparse monitor
    configurations. So instead of sending down an update where display #0 is off
    and display #1 is WxH, we send down an update that only a single display:
    display #0 is WxH. This results in the first display becoming enabled.
    To solve the issue, we wait until the agent negotiates capabilities
    before sending the display configuration message.
    Resolves: rhbz#1043782, rhbz#1032923

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index f33b0fd..6c1b3be 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1508,7 +1508,6 @@ static void main_handle_mouse_mode(SpiceChannel *channel, SpiceMsgIn *in)
 static void main_handle_agent_connected(SpiceChannel *channel, SpiceMsgIn *in)
-    update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 /* coroutine context */
@@ -1519,7 +1518,6 @@ static void main_handle_agent_connected_tokens(SpiceChannel *channel, SpiceMsgIn
     c->agent_tokens = msg->num_tokens;
-    update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 /* coroutine context */
@@ -1790,6 +1788,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         c->agent_caps_received = true;
         g_coroutine_signal_emit(self, signals[SPICE_MAIN_AGENT_UPDATE], 0);
+        update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
         if (caps->request)

More information about the Spice-commits mailing list