[gnome-control-center] sharing: Prevent an endless loop and resulting stack overflow



commit 7121f03564a4ece16f2952a8cec6f6bbcf82a4f5
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Nov 10 15:06:52 2014 +0100

    sharing: Prevent an endless loop and resulting stack overflow
    
    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

 panels/sharing/cc-sharing-networks.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-networks.c b/panels/sharing/cc-sharing-networks.c
index 181ed99..10920de 100644
--- a/panels/sharing/cc-sharing-networks.c
+++ b/panels/sharing/cc-sharing-networks.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]