UPnPDB-fix-observer-removal-locking.patch 525 B

1234567891011121314151617181920
  1. diff -ru upnpx-1.2.4/src/upnp/UPnPDB.m upnpx/src/upnp/UPnPDB.m
  2. --- upnpx-1.2.4/src/upnp/UPnPDB.m 2012-03-07 20:53:57.000000000 +0100
  3. +++ upnpx/src/upnp/UPnPDB.m 2013-10-01 19:01:29.000000000 +0200
  4. @@ -98,10 +98,11 @@
  5. -(int)removeObserver:(UPnPDBObserver*)obs{
  6. int ret = 0;
  7. - [self lock];
  8. - [mObservers removeObject:obs];
  9. - ret = [mObservers count];
  10. - [self unlock];
  11. + if ([mMutex tryLock]) {
  12. + [mObservers removeObject:obs];
  13. + ret = [mObservers count];
  14. + [self unlock];
  15. + }
  16. return ret;
  17. }