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.
(cherry picked from commit 7157ad33673305f7947fe84ca78374bdba5e64f8)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
This commit is contained in:
Derk-Jan Hartman 2009-05-29 20:42:37 +02:00 committed by Jean-Baptiste Kempf
parent 2ccc18b42a
commit c062239e6c
2 changed files with 6 additions and 1 deletions

View File

@ -86,6 +86,7 @@ The class is not thread safe
IOHIDQueueInterface** queue;
NSMutableArray* allCookies;
NSMutableDictionary* cookieToButtonMapping;
CFRunLoopSourceRef eventSource;
BOOL openInExclusiveMode;
BOOL simulatePlusMinusHold;

View File

@ -231,6 +231,11 @@ cleanup:
}
- (IBAction) stopListening: (id) sender {
if (eventSource != NULL) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), eventSource, kCFRunLoopDefaultMode);
CFRelease(eventSource);
eventSource = NULL;
}
if (queue != NULL) {
(*queue)->stop(queue);
@ -619,7 +624,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
}
// add callback for async events
CFRunLoopSourceRef eventSource;
ioReturnValue = (*queue)->createAsyncEventSource(queue, &eventSource);
if (ioReturnValue == KERN_SUCCESS) {
ioReturnValue = (*queue)->setEventCallout(queue,QueueCallbackFunction, self, NULL);