sharing: Prevent an endless loop and resulting stack overflow
authorRui Matos <tiagomatos@gmail.com>
Mon, 10 Nov 2014 14:06:52 +0000 (15:06 +0100)
committerAndreas Henriksson <andreas@fatal.se>
Thu, 5 Feb 2015 18:44:41 +0000 (18:44 +0000)
We need to block ourselves around the gtk_switch_set_active() call in
the error path, when we can't speak to the sharing dbus service, or we
end up in an endless loop since we're the ::state-set handler.

https://bugzilla.gnome.org/show_bug.cgi?id=739886

Gbp-Pq: Name 30_stack_overflow.patch

panels/sharing/cc-sharing-networks.c

index 181ed99d1576e414bf865c7042dee99a4071ced1..10920dee0a9b6aedc2ade789ad9126ae8453bc93 100644 (file)
@@ -190,7 +190,11 @@ cc_sharing_networks_enable_network (GtkSwitch *widget,
     g_warning ("Failed to %s service %s: %s", state ? "enable" : "disable",
               self->priv->service_name, error->message);
     g_error_free (error);
+    g_signal_handlers_block_by_func (widget,
+                                     cc_sharing_networks_enable_network, self);
     gtk_switch_set_active (widget, !state);
+    g_signal_handlers_unblock_by_func (widget,
+                                       cc_sharing_networks_enable_network, self);
   }
 
   cc_sharing_update_networks (self);