[gupnp] Prevent possible crash if device disappears
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] Prevent possible crash if device disappears
- Date: Mon, 29 Aug 2011 20:26:20 +0000 (UTC)
commit 791f702c8e4d1fed0f456d35be97a354813d4dd5
Author: Jens Georg <mail jensge org>
Date: Thu Aug 4 15:01:54 2011 +0200
Prevent possible crash if device disappears
Might happen e.g. on usbnet devices when cable is unplugged.
https://bugzilla.gnome.org/show_bug.cgi?id=655970
libgupnp/gupnp-linux-context-manager.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/libgupnp/gupnp-linux-context-manager.c b/libgupnp/gupnp-linux-context-manager.c
index dce036e..a0f1cfc 100644
--- a/libgupnp/gupnp-linux-context-manager.c
+++ b/libgupnp/gupnp-linux-context-manager.c
@@ -311,7 +311,10 @@ remove_context (GUPnPLinuxContextManager *self, struct ifaddrmsg *ifa)
device = g_hash_table_lookup (self->priv->interfaces,
GINT_TO_POINTER (ifa->ifa_index));
- if (device && device->context) {
+ if (!device)
+ return;
+
+ if (device->context) {
if (device->flags & NETWORK_INTERFACE_UP)
g_signal_emit_by_name (self,
"context-unavailable",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]