提交 56d22039 编写于 作者: P Palana

mac-syphon: Move release calls to helper function

上级 afa172fe
...@@ -36,6 +36,12 @@ struct syphon { ...@@ -36,6 +36,12 @@ struct syphon {
}; };
typedef struct syphon *syphon_t; typedef struct syphon *syphon_t;
static inline void objc_release(NSObject **obj)
{
[*obj release];
*obj = nil;
}
static inline void update_properties(syphon_t s) static inline void update_properties(syphon_t s)
{ {
obs_source_update_properties(s->source); obs_source_update_properties(s->source);
...@@ -91,8 +97,7 @@ static void stop_client(syphon_t s) ...@@ -91,8 +97,7 @@ static void stop_client(syphon_t s)
if (s->client) { if (s->client) {
@autoreleasepool { @autoreleasepool {
[s->client stop]; [s->client stop];
[s->client release]; objc_release(&s->client);
s->client = nil;
} }
} }
...@@ -500,7 +505,7 @@ static inline void syphon_destroy_internal(syphon_t s) ...@@ -500,7 +505,7 @@ static inline void syphon_destroy_internal(syphon_t s)
NSWorkspace *ws = [NSWorkspace sharedWorkspace]; NSWorkspace *ws = [NSWorkspace sharedWorkspace];
[ws removeObserver:s->launch_listener [ws removeObserver:s->launch_listener
forKeyPath:NSStringFromSelector(@selector(runningApplications))]; forKeyPath:NSStringFromSelector(@selector(runningApplications))];
[s->launch_listener release]; objc_release(&s->launch_listener);
obs_data_release(s->inject_info); obs_data_release(s->inject_info);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册