Blame SOURCES/Properly-remove-watches-when-changing-server-props.patch

ee1027
From 56ac24642d60ef8398f3e44f571337e0224c6857 Mon Sep 17 00:00:00 2001
ee1027
From: Ondrej Holy <oholy@redhat.com>
ee1027
Date: Fri, 24 Aug 2018 15:11:58 +0200
ee1027
Subject: [PATCH] Properly remove watches when changing server props
ee1027
ee1027
vino_server_init_io_channels calls vino_server_deinit_io_channels
ee1027
at the beginning, however the watches and channels don't have to be
ee1027
removed respective closed, because it relies on rfbListenSock array,
ee1027
which can be already modified as a consequence of changing server
ee1027
properties. Let's call vino_server_deinit_io_channels before changing
ee1027
server properties in order to prevent the following errors:
ee1027
ee1027
rfbCheckFds: accept: Invalid argument
ee1027
ee1027
https://bugzilla.gnome.org/show_bug.cgi?id=796349
ee1027
---
ee1027
 server/vino-server.c | 13 ++++++++++---
ee1027
 1 file changed, 10 insertions(+), 3 deletions(-)
ee1027
ee1027
diff --git a/server/vino-server.c b/server/vino-server.c
ee1027
index b8cd755..7e5599b 100644
ee1027
--- a/server/vino-server.c
ee1027
+++ b/server/vino-server.c
ee1027
@@ -963,8 +963,6 @@ vino_server_init_io_channels(VinoServer *server)
ee1027
   rfbScreenInfoPtr rfb_screen = server->priv->rfb_screen;
ee1027
   int              i;
ee1027
 
ee1027
-  vino_server_deinit_io_channels (server);
ee1027
-
ee1027
   dprintf (RFB, "Creating watch for listening socket [ ");
ee1027
   for (i=0; i < rfb_screen->rfbListenSockTotal; i++)
ee1027
     {
ee1027
@@ -1085,6 +1083,7 @@ vino_server_init_from_screen (VinoServer *server,
ee1027
 
ee1027
   vino_server_update_security_types (server);
ee1027
 
ee1027
+  vino_server_deinit_io_channels (server);
ee1027
   vino_server_init_io_channels (server);
ee1027
 
ee1027
   vino_mdns_add_service ("_rfb._tcp", rfb_screen->rfbPort);
ee1027
@@ -1624,7 +1623,12 @@ vino_server_set_network_interface (VinoServer *server,
ee1027
     server->priv->network_interface = NULL;
ee1027
 
ee1027
   if (server->priv->rfb_screen != NULL)
ee1027
-    rfbSetNetworkInterface (server->priv->rfb_screen, server->priv->network_interface);
ee1027
+    {
ee1027
+      vino_server_deinit_io_channels (server);
ee1027
+      rfbSetNetworkInterface (server->priv->rfb_screen, server->priv->network_interface);
ee1027
+      vino_server_init_io_channels (server);
ee1027
+      vino_server_control_upnp (server);
ee1027
+    }
ee1027
 
ee1027
   g_object_notify (G_OBJECT (server), "network-interface");
ee1027
 }
ee1027
@@ -1651,6 +1655,8 @@ vino_server_set_use_alternative_port (VinoServer *server,
ee1027
 
ee1027
       if (server->priv->rfb_screen)
ee1027
         {
ee1027
+          vino_server_deinit_io_channels (server);
ee1027
+
ee1027
           if (server->priv->use_alternative_port)
ee1027
             rfbSetPort (server->priv->rfb_screen,
ee1027
                         server->priv->alternative_port);
ee1027
@@ -1688,6 +1694,7 @@ vino_server_set_alternative_port (VinoServer *server,
ee1027
       if (server->priv->rfb_screen &&
ee1027
           server->priv->use_alternative_port)
ee1027
 	{
ee1027
+          vino_server_deinit_io_channels (server);
ee1027
 	  rfbSetPort (server->priv->rfb_screen, server->priv->alternative_port);
ee1027
 	  vino_server_init_io_channels (server);
ee1027
 	  vino_server_control_upnp (server);
ee1027
-- 
ee1027
2.19.0
ee1027