From 6403e74fab134b799ff3b755d4e30a6302205d32 Mon Sep 17 00:00:00 2001 From: Anders Malm Date: Thu, 7 Mar 2013 15:31:43 +0100 Subject: [PATCH] Fix for MOSYNC-2926. iOS memory leak in maWidgetSetProperty --- .../NativeUI/Syscalls/MoSyncUISyscalls.mm | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm b/runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm index cb3cc6a11..9f5baad5e 100644 --- a/runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm +++ b/runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm @@ -382,25 +382,29 @@ int maWidgetSetProperty(MAWidgetHandle handle, const char *property, const char* IWidget* widget = [mosyncUI getWidget:handle]; if(widget == NULL) return MAW_RES_INVALID_HANDLE; + if(property == NULL) + return MAW_RES_INVALID_PROPERTY_NAME; + + if(value == NULL) + return MAW_RES_INVALID_PROPERTY_VALUE; + NSString* propertyString = stringFromChar(property); if([widget class] == [GLViewWidget class] || [widget class] == [GL2ViewWidget class] ) { // do this from the MoSync thread. Maybe do a generic system for this later. - if([propertyString isEqualToString:@"bind"]) { + if([propertyString isEqualToString:@"bind"]) + { + [propertyString release]; return [widget setPropertyWithKey:@"bind" toValue:@""]; } - if([propertyString isEqualToString:@"invalidate"]) { + if([propertyString isEqualToString:@"invalidate"]) + { + [propertyString release]; return [widget setPropertyWithKey:@"invalidate" toValue:@""]; } } - if(property == NULL) - return MAW_RES_INVALID_PROPERTY_NAME; - - if(value == NULL) - return MAW_RES_INVALID_PROPERTY_VALUE; - int returnValue; NSString *valueString = stringFromChar(value);