summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-05-23 01:16:29 +0200
committerGravatar Nikias Bassen2019-05-23 01:16:29 +0200
commit8b82ef166eb2ac12bc5228cf06a883ec86d520ca (patch)
tree4c934a247cbd6cd9519279bfd5048a3bd28fc461 /src
parenta6b542b389d0536d2730c1721164a712ec2f020e (diff)
downloadlibusbmuxd-8b82ef166eb2ac12bc5228cf06a883ec86d520ca.tar.gz
libusbmuxd-8b82ef166eb2ac12bc5228cf06a883ec86d520ca.tar.bz2
Make sure to send device remove events when unregistering the callback
Diffstat (limited to 'src')
-rw-r--r--src/libusbmuxd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index 340d75a..d971f14 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -1155,6 +1155,14 @@ USBMUXD_API int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t ctx)
mutex_lock(&listener_mutex);
if (collection_remove(&listeners, ctx) == 0) {
+ FOREACH(usbmuxd_device_info_t *dev, &devices) {
+ if (dev) {
+ usbmuxd_event_t ev;
+ ev.event = UE_DEVICE_REMOVE;
+ memcpy(&ev.device, dev, sizeof(usbmuxd_device_info_t));
+ (ctx)->callback(&ev, (ctx)->user_data);
+ }
+ } ENDFOREACH
free(ctx);
}
num = collection_count(&listeners);