summaryrefslogtreecommitdiff
path: root/gusb/gusb-context.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-11-26 21:37:41 +0000
committerRichard Hughes <richard@hughsie.com>2014-11-26 21:37:41 +0000
commit8aee02701ec20904fbabe8e5ebae725ce583e7d1 (patch)
treebccf61563bd1868ee2f9ca967b02555b6d6e03f4 /gusb/gusb-context.c
parent9841ee7cc4a30897b0c1f7286c13984f0e9b1d87 (diff)
downloadgusb-8aee02701ec20904fbabe8e5ebae725ce583e7d1.tar.gz
Correctly terminate the libusb event thread
Diffstat (limited to 'gusb/gusb-context.c')
-rw-r--r--gusb/gusb-context.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c
index f950eb2..81f0eaa 100644
--- a/gusb/gusb-context.c
+++ b/gusb/gusb-context.c
@@ -487,11 +487,11 @@ g_usb_context_finalize (GObject *object)
GUsbContext *context = G_USB_CONTEXT (object);
GUsbContextPrivate *priv = context->priv;
+ /* this is safe to call even when priv->hotplug_id is unset */
priv->thread_event_run = FALSE;
+ libusb_hotplug_deregister_callback (priv->ctx, priv->hotplug_id);
g_thread_join (priv->thread_event);
- if (priv->hotplug_id > 0)
- libusb_hotplug_deregister_callback (priv->ctx, priv->hotplug_id);
if (priv->hotplug_poll_id > 0)
g_source_remove (priv->hotplug_poll_id);
g_ptr_array_unref (priv->devices);