aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Parker <palfrey@tevp.net>2009-11-18 20:44:09 +0800
committerXan Lopez <xan@gnome.org>2009-11-18 20:44:09 +0800
commit76d1c18d5cd267a97ef2a33950cb6b837032bd80 (patch)
treee0c0b22f93c82ca585395275860df54d957a55a7
parentb60ae4ba76dcafc93bc805203e4962ade100f300 (diff)
downloadgsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar.gz
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar.bz2
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar.lz
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar.xz
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.tar.zst
gsoc2013-epiphany-76d1c18d5cd267a97ef2a33950cb6b837032bd80.zip
Disconnect dbus callbacks when disposing of the monitor.
Fixes a crash in some situations, bug #572326 Signed-off-by: Xan Lopez <xan@gnome.org>
-rw-r--r--src/ephy-net-monitor.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/ephy-net-monitor.c b/src/ephy-net-monitor.c
index 69f8be7b7..3107ad243 100644
--- a/src/ephy-net-monitor.c
+++ b/src/ephy-net-monitor.c
@@ -107,7 +107,7 @@ ephy_net_monitor_check_network (EphyNetMonitor *monitor)
DBusMessage *message;
DBusPendingCall* reply;
- if (priv->bus == NULL) return;
+ g_return_if_fail (priv == NULL || priv->bus == NULL);
LOG ("EphyNetMonitor checking network");
@@ -199,6 +199,23 @@ ephy_net_monitor_attach_to_dbus (EphyNetMonitor *monitor)
}
static void
+ephy_net_monitor_detach_from_dbus (EphyNetMonitor *monitor)
+{
+ EphyNetMonitorPrivate *priv = monitor->priv;
+
+ LOG ("EphyNetMonitor is trying to detach from SYSTEM bus");
+
+ if (priv->bus != NULL)
+ {
+ dbus_connection_remove_filter (priv->bus,
+ filter_func,
+ monitor);
+ priv->bus = NULL;
+ }
+}
+
+
+static void
connect_to_system_bus_cb (EphyDbus *dbus,
EphyDbusBus kind,
EphyNetMonitor *monitor)
@@ -216,14 +233,12 @@ disconnect_from_system_bus_cb (EphyDbus *dbus,
EphyDbusBus kind,
EphyNetMonitor *monitor)
{
- EphyNetMonitorPrivate *priv = monitor->priv;
-
if (kind == EPHY_DBUS_SYSTEM)
{
LOG ("EphyNetMonitor disconnected from SYSTEM bus");
/* no bus anymore */
- priv->bus = NULL;
+ ephy_net_monitor_detach_from_dbus (monitor);
}
}
@@ -258,6 +273,7 @@ ephy_net_monitor_shutdown (EphyNetMonitor *monitor)
dbus = ephy_dbus_get_default ();
+ ephy_net_monitor_detach_from_dbus (monitor);
g_signal_handlers_disconnect_by_func
(dbus, G_CALLBACK (connect_to_system_bus_cb), monitor);
g_signal_handlers_disconnect_by_func