Cocoa Port:

- Fix memory leak when dispatching commands from an InputManager object.
- Fix potential memory leak that can occur if InputHIDManagerTarget delegates created autorelease-able objects within the handleHIDQueue: method.
This commit is contained in:
rogerman 2013-04-19 02:16:58 +00:00
parent dd2942dc63
commit 7d4983eb11
1 changed files with 8 additions and 2 deletions

View File

@ -636,7 +636,9 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
if (target != nil) if (target != nil)
{ {
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
[[hidManager target] handleHIDQueue:hidQueue]; [[hidManager target] handleHIDQueue:hidQueue];
[tempPool release];
} }
else else
{ {
@ -1239,7 +1241,9 @@ static std::tr1::unordered_map<unsigned short, std::string> keyboardNameTable; /
if ([emuControl respondsToSelector:cmdAttr.selector]) if ([emuControl respondsToSelector:cmdAttr.selector])
{ {
[emuControl performSelector:cmdAttr.selector withObject:[NSValue valueWithBytes:&cmdAttr objCType:@encode(CommandAttributes)]]; NSValue *cmdObject = [[NSValue alloc] initWithBytes:&cmdAttr objCType:@encode(CommandAttributes)];
[emuControl performSelector:cmdAttr.selector withObject:cmdObject];
[cmdObject release];
} }
} }
} }
@ -1268,7 +1272,9 @@ static std::tr1::unordered_map<unsigned short, std::string> keyboardNameTable; /
if ([emuControl respondsToSelector:cmdAttr.selector]) if ([emuControl respondsToSelector:cmdAttr.selector])
{ {
[emuControl performSelector:cmdAttr.selector withObject:[NSValue valueWithBytes:&cmdAttr objCType:@encode(CommandAttributes)]]; NSValue *cmdObject = [[NSValue alloc] initWithBytes:&cmdAttr objCType:@encode(CommandAttributes)];
[emuControl performSelector:cmdAttr.selector withObject:cmdObject];
[cmdObject release];
} }
didCommandDispatch = YES; didCommandDispatch = YES;