@@ -105,14 +105,14 @@ - (void)dealloc { [_name release]; [_observer release]; + [_object release]; #ifdef OF_HAVE_BLOCKS [_block release]; #endif - [_object release]; [super dealloc]; } - (bool)isEqual: (OFNotificationCenterHandle *)handle @@ -267,10 +267,12 @@ } #endif - (void)removeObserver: (OFNotificationCenterHandle *)handle { + void *pool = objc_autoreleasePoolPush(); + if (![handle isKindOfClass: [OFNotificationCenterHandle class]]) @throw [OFInvalidArgumentException exception]; #ifdef OF_HAVE_THREADS [_mutex lock]; @@ -286,10 +288,12 @@ #ifdef OF_HAVE_THREADS } @finally { [_mutex unlock]; } #endif + + objc_autoreleasePoolPop(pool); } - (void)removeObserver: (id)observer selector: (SEL)selector name: (OFNotificationName)name @@ -342,10 +346,30 @@ notification); #ifdef OF_HAVE_BLOCKS } #endif } + + objc_autoreleasePoolPop(pool); +} + +- (void)postNotificationName: (OFNotificationName)name + object: (nullable id)object +{ + [self postNotificationName: name object: object userInfo: nil]; +} + +- (void)postNotificationName: (OFNotificationName)name + object: (nullable id)object + userInfo: (nullable OFDictionary *)userInfo +{ + void *pool = objc_autoreleasePoolPush(); + + [self postNotification: + [OFNotification notificationWithName: name + object: object + userInfo: userInfo]]; objc_autoreleasePoolPop(pool); } @end