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

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