Commit 7157ad33 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

macosx remote: Fix a leak in the Apple Remote class.

A thank you to the Xbmc authors who had this fixed in their version of Martin Kahr's class.
parent ced7fc2d
...@@ -86,6 +86,7 @@ The class is not thread safe ...@@ -86,6 +86,7 @@ The class is not thread safe
IOHIDQueueInterface** queue; IOHIDQueueInterface** queue;
NSMutableArray* allCookies; NSMutableArray* allCookies;
NSMutableDictionary* cookieToButtonMapping; NSMutableDictionary* cookieToButtonMapping;
CFRunLoopSourceRef eventSource;
BOOL openInExclusiveMode; BOOL openInExclusiveMode;
BOOL simulatePlusMinusHold; BOOL simulatePlusMinusHold;
......
...@@ -231,6 +231,11 @@ cleanup: ...@@ -231,6 +231,11 @@ cleanup:
} }
- (IBAction) stopListening: (id) sender { - (IBAction) stopListening: (id) sender {
if (eventSource != NULL) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), eventSource, kCFRunLoopDefaultMode);
CFRelease(eventSource);
eventSource = NULL;
}
if (queue != NULL) { if (queue != NULL) {
(*queue)->stop(queue); (*queue)->stop(queue);
...@@ -619,7 +624,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -619,7 +624,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
} }
// add callback for async events // add callback for async events
CFRunLoopSourceRef eventSource;
ioReturnValue = (*queue)->createAsyncEventSource(queue, &eventSource); ioReturnValue = (*queue)->createAsyncEventSource(queue, &eventSource);
if (ioReturnValue == KERN_SUCCESS) { if (ioReturnValue == KERN_SUCCESS) {
ioReturnValue = (*queue)->setEventCallout(queue,QueueCallbackFunction, self, NULL); ioReturnValue = (*queue)->setEventCallout(queue,QueueCallbackFunction, self, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment