From a89ae1517289b81fa0c5ef26042f77e650b8e3f7 Mon Sep 17 00:00:00 2001 From: Spiridon Alexandru Date: Fri, 1 Mar 2013 16:41:29 +0200 Subject: [PATCH 01/12] MOSYNC-2884: changed the bing maps api key; added a Readme file to the native ui MapTest program --- testPrograms/native_ui_lib/MapTest/MainScreen.cpp | 2 +- testPrograms/native_ui_lib/MapTest/Readme.txt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 testPrograms/native_ui_lib/MapTest/Readme.txt diff --git a/testPrograms/native_ui_lib/MapTest/MainScreen.cpp b/testPrograms/native_ui_lib/MapTest/MainScreen.cpp index 271aa33ff..4df847187 100644 --- a/testPrograms/native_ui_lib/MapTest/MainScreen.cpp +++ b/testPrograms/native_ui_lib/MapTest/MainScreen.cpp @@ -97,7 +97,7 @@ void MainScreen::createMainLayout() { mMainLayout->addChild(mSetCenterButton); // create the main map and add it to the main layout - mMap = new Map("google test credentials", "AsIe6nHOHjIuf9MQS4fW7up92BO6HuCwspKJqYwffZiqUJsgXuLIXeBdCf9EM4yz"); + mMap = new Map("google test credentials", "AuQ7GMB3AJPFp5GPHbuQ2WVyhQUd9DjYJ6u5aR6a_uXZZdX5KuHJ7XMU4GNvO6mh"); mMap->fillSpaceHorizontally(); mMap->fillSpaceVertically(); diff --git a/testPrograms/native_ui_lib/MapTest/Readme.txt b/testPrograms/native_ui_lib/MapTest/Readme.txt new file mode 100644 index 000000000..07df877f2 --- /dev/null +++ b/testPrograms/native_ui_lib/MapTest/Readme.txt @@ -0,0 +1,13 @@ +Purpose: +The test program shows the native ui map functionality and provides UI elements for doing +the following: + - add/remove multiple random map pins + - set/get visible area + - set zoom level + - center the map + - a map control is visible and available for interraction to the user + +IMPORTANT: + ADD YOU OWN MAP CREDENTIALS INSIDE THE MAP CONSTRUCTOR: + MainScreen.cpp: + mMap = new Map("google maps test credentials", "bing maps test credentials"); \ No newline at end of file From 6f43fe36074fc1711ce2fb54d08b42fcc661cef7 Mon Sep 17 00:00:00 2001 From: Spiridon Alexandru Date: Fri, 1 Mar 2013 17:38:39 +0200 Subject: [PATCH 02/12] MOSYNC-2884: small wp7 runtime map widget refactorization --- .../mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs index 0c73f4edf..81d2c1bfb 100644 --- a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs +++ b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs @@ -60,6 +60,8 @@ public class Map : WidgetBaseWindowsPhone // used to center the map on an area described by the upper left corner and the lower right corner System.Device.Location.GeoCoordinate mVisibleAreaLowerRightCorner; + private CredentialsProvider mCredentialsProvider; + /** * Constructor */ @@ -149,7 +151,8 @@ public string ApiKey { set { - mBingMap.CredentialsProvider = new ApplicationIdCredentialsProvider(value); + mCredentialsProvider = new ApplicationIdCredentialsProvider(value); + mBingMap.CredentialsProvider = mCredentialsProvider; } } From e2bfbb104de3f2dd865c700035c722df37caed26 Mon Sep 17 00:00:00 2001 From: Spiridon Alexandru Date: Mon, 4 Mar 2013 11:38:10 +0200 Subject: [PATCH 03/12] MOSYNC-2884: added a readme file to the NativeUIMap example program --- examples/cpp/NativeUIMap/Readme.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/cpp/NativeUIMap/Readme.txt diff --git a/examples/cpp/NativeUIMap/Readme.txt b/examples/cpp/NativeUIMap/Readme.txt new file mode 100644 index 000000000..07df877f2 --- /dev/null +++ b/examples/cpp/NativeUIMap/Readme.txt @@ -0,0 +1,13 @@ +Purpose: +The test program shows the native ui map functionality and provides UI elements for doing +the following: + - add/remove multiple random map pins + - set/get visible area + - set zoom level + - center the map + - a map control is visible and available for interraction to the user + +IMPORTANT: + ADD YOU OWN MAP CREDENTIALS INSIDE THE MAP CONSTRUCTOR: + MainScreen.cpp: + mMap = new Map("google maps test credentials", "bing maps test credentials"); \ No newline at end of file From 0f57a237fc33164ea2eaa735c0a59071745907fb Mon Sep 17 00:00:00 2001 From: mircea Date: Mon, 4 Mar 2013 15:25:16 +0200 Subject: [PATCH 04/12] MOSYNC-2903. Fix for WikiSearchNativeUI crash. --- .../iphone/Classes/NativeUI/Widgets/WebViewWidget.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm b/runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm index 261902178..ff8d71f59 100644 --- a/runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm +++ b/runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm @@ -76,15 +76,17 @@ - (int)setPropertyWithKey: (NSString*)key toValue: (NSString*)value { { NSURL *url; //Process a normal URL + //URLs can only be sent over the Internet using the ASCII character-set. if (schemaLocation.location == NSNotFound) { NSString *urlString = [NSString stringWithFormat:@"%@%@", baseUrl, value]; - NSString* webURLString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString* webURLString = [urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; url = [[NSURL URLWithString: webURLString] filePathURL]; } else { // Convert the string URL into ascii encoding. - NSData* data = [value dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; - NSString* formattedURL = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - url = [NSURL URLWithString:formattedURL]; + NSData* data = [value dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; + NSString* formattedURL = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; + // Used stringByAddingPercentEscapesUsingEncoding in order to replace spaces with speficit percent characters. + url = [NSURL URLWithString:[formattedURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]; [formattedURL release]; } From 2868d8d03eb47a00ce91e1c70191175dc3a87763 Mon Sep 17 00:00:00 2001 From: Bogdan Iusco Date: Tue, 5 Mar 2013 09:14:55 +0200 Subject: [PATCH 05/12] MOSYNC-2910 "EuropeanCountries have the alphabetic letter at the foot of the list on Android" --- .../src/com/mosync/nativeui/ui/widgets/ListViewSection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java index 44f18946d..c1594a419 100644 --- a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java +++ b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java @@ -185,6 +185,7 @@ public boolean setProperty(String property, String value) createSegmentedSectionDefaultUI(); break; case IX_WIDGET.MAW_LIST_VIEW_SECTION_TYPE_ALPHABETICAL: + mHasFooter = false; break; default: Log.e("@@MoSync","maWidgetSetProperty invalid List View Section type"); @@ -516,6 +517,7 @@ public void setAlphaSectionFooter(String text) { // Create and add the footer after the last item - if that exists. addSectionFooter(); + mHasFooter = true; setFooterText(text); if (mAdapterListener != null) mAdapterListener.itemAdded(mItems.get(mItems.size()), this, mItems.size()); From f72d6e2bc731539eba36ded052b1734d88c781fd Mon Sep 17 00:00:00 2001 From: Emma Tresanszki Date: Tue, 5 Mar 2013 15:18:47 +0200 Subject: [PATCH 06/12] MOSYNC-2899 WikiSearch crash because Content-length field from response header cannpt be retrieved --- examples/cpp/WikiSearchNativeUI/Util.h | 14 ++++++++++++++ examples/cpp/WikiSearchNativeUI/WikiEngine.cpp | 17 +++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/examples/cpp/WikiSearchNativeUI/Util.h b/examples/cpp/WikiSearchNativeUI/Util.h index 99f2db82d..106f90fb4 100644 --- a/examples/cpp/WikiSearchNativeUI/Util.h +++ b/examples/cpp/WikiSearchNativeUI/Util.h @@ -122,6 +122,20 @@ const MAUtil::String ERROR_NO_RESULTS = "There are no results."; /** The results cannot be parsed. **/ const MAUtil::String ERROR_INVALID_DATA = "Invalid results.Error:"; +// Some Http request and response field names. +/** +* Field name that can be used for #maHttpSetRequestHeader. +*/ +const String HTTP_REQUEST_HEADER_USER_AGENT = "User-Agent"; +/** +* Field name that can be used for #maHttpSetRequestHeader. +*/ +const String HTTP_REQUEST_HEADER_ACCEPT_ENCODING = "Accept-Encoding"; +/** +* Field name that can be used for @maHttpGetResponseHeader. +*/ +const String HTTP_RESPONSE_HEADER_CONTENT_LENGTH = "Content-Length"; + /** * Utility functions for creating NativeUI widgets. */ diff --git a/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp b/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp index 0988c051e..591448c07 100644 --- a/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp +++ b/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp @@ -224,12 +224,18 @@ void MediaWiki::search(MAUtil::String searchTerm, int resultsLimit) constructApiUrl(); int res = mHttp.create(mWiki->apiUrl.c_str(), HTTP_GET); + + // Enforce compress disabling, so we can count on a real content length value. + mHttp.setRequestHeader("Accept-Encoding","identity"); + mHttp.setRequestHeader(HTTP_REQUEST_HEADER_USER_AGENT.c_str(),"WikipediaSearchNativeUI"); + if(res < 0) { // It have failed for some reason. - mHomeScreen->engineError(ERROR_NO_CONNECTION); + mHomeScreen->engineError("The error is " + MAUtil::integerToString(res));//ERROR_NO_CONNECTION); + mHttp.close(); + mIsConnected = false; } else { - mHttp.setRequestHeader("User-Agent","WikipediaSearchNativeUI"); mHttp.finish(); mIsConnected = true; } @@ -248,14 +254,13 @@ void MediaWiki::httpFinished(MAUtil::HttpConnection *conn, int result) if ( result >= 0) { MAUtil::String contentLengthStr; - // todo: check return value. - mHttp.getResponseHeader("Content-Length", + mHttp.getResponseHeader(HTTP_RESPONSE_HEADER_CONTENT_LENGTH.c_str(), &contentLengthStr); int contentLength = 0; contentLength = atoi(contentLengthStr.c_str()); - if (contentLength >= CONNECTION_BUFFER_SIZE || contentLength == 0) { + if (contentLength >= CONNECTION_BUFFER_SIZE || contentLength != 0) { // Receive in chunks. // Calculate how many chunks we receive, so that we can increment // a progress bar for this action. @@ -282,7 +287,7 @@ void MediaWiki::httpFinished(MAUtil::HttpConnection *conn, int result) else { // Notify UI on the error. - mHomeScreen->engineError( ERROR_NO_CONNECTION ); + mHomeScreen->engineError( MAUtil::integerToString(result));//ERROR_NO_CONNECTION ); mHttp.close(); mIsConnected = false; From bc8da0c77bdc3d3a81d25c4e675223314bd8cfa1 Mon Sep 17 00:00:00 2001 From: Emma Tresanszki Date: Tue, 5 Mar 2013 15:25:32 +0200 Subject: [PATCH 07/12] MOSYNC-2899 Part Two --- examples/cpp/WikiSearchNativeUI/WikiEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp b/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp index 591448c07..6c528b520 100644 --- a/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp +++ b/examples/cpp/WikiSearchNativeUI/WikiEngine.cpp @@ -226,7 +226,7 @@ void MediaWiki::search(MAUtil::String searchTerm, int resultsLimit) int res = mHttp.create(mWiki->apiUrl.c_str(), HTTP_GET); // Enforce compress disabling, so we can count on a real content length value. - mHttp.setRequestHeader("Accept-Encoding","identity"); + mHttp.setRequestHeader(HTTP_REQUEST_HEADER_ACCEPT_ENCODING.c_str(),"identity"); mHttp.setRequestHeader(HTTP_REQUEST_HEADER_USER_AGENT.c_str(),"WikipediaSearchNativeUI"); if(res < 0) { From e446d50d95646bf63f1f74e8fa9e7e87f91b0c1e Mon Sep 17 00:00:00 2001 From: Emma Tresanszki Date: Wed, 6 Mar 2013 15:06:46 +0200 Subject: [PATCH 08/12] MOSYNC-2920 LocalNotification destroy bug: it also cancelled the pending intent --- .../LocalNotificationsManager.java | 30 +------------------ .../LocalNotificationSender/ReadMe.txt | 9 +++--- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java index 8bbd3d59d..e0fc3c877 100644 --- a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java +++ b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java @@ -100,35 +100,6 @@ public int destroy(int handle) LocalNotificationObject notification = m_NotificationTable.get(handle); if ( null != notification ) { - // Remove the service notification if it is pending. - if ( notification.isActive() ) - { - LocalNotificationsService.removeServiceNotification( - m_NotificationTable.get(handle).getId(), - mMoSyncThread.getActivity()); - - // Stop the service, even when the application is in background. - LocalNotificationsService.stopService(); - } - // Cancel the intent assigned to the notification if scheduled. - if ( null != m_Intents.get(handle) ) - { - AlarmManager alarmManager = - (AlarmManager) mMoSyncThread.getActivity().getSystemService(Context.ALARM_SERVICE); - - // Set the unique request code as the handle. - PendingIntent pendingIntent = PendingIntent.getBroadcast( - mMoSyncThread.getActivity(), - notification.getRequestCode(), - m_Intents.get(handle), - PendingIntent.FLAG_NO_CREATE); - if ( pendingIntent != null ) - { - alarmManager.cancel(pendingIntent); - } - m_Intents.remove(handle); - } - // Remove the internal notification object. m_NotificationTable.remove(handle); @@ -296,6 +267,7 @@ public int schedule(final int handle, final Context appContext) alarmManager.set(AlarmManager.RTC_WAKEUP, notification.getFireDate(), pendingIntent); m_Intents.put(handle, intent); + return MA_NOTIFICATION_RES_OK; } } diff --git a/testPrograms/notification/LocalNotificationSender/ReadMe.txt b/testPrograms/notification/LocalNotificationSender/ReadMe.txt index 1f11c307e..040da0a0d 100644 --- a/testPrograms/notification/LocalNotificationSender/ReadMe.txt +++ b/testPrograms/notification/LocalNotificationSender/ReadMe.txt @@ -4,10 +4,12 @@ On Android only there are two more texts to set: - content body title and - the ticker text. (Ticker text: the text that flows by in the status bar when the notification first activates.) + Next, you can set for iOS only: - the badge number, -the alert action (the title of the action button or slider). - Next the Default Sound can be enabled/disabled. + +Next the Default Sound can be enabled/disabled. Below, settings available only on Android: - the Vibration settings ( that are available only on Android): By checking the Vibration check box, the default vibration pattern is applied. If the vibration duration is set, it will be used instead. @@ -15,14 +17,11 @@ vibration pattern is applied. If the vibration duration is set, it will be used pattern is applied to the notification. If the pattern is set(by filling the next 3 edit boxes), it will be used instead. If the flashing is not supported on the device you will get the message "Not available" inside the edit boxes for this settings. Note that you need to enable the Notification LED lights from device's Settings. + The Flashing pattern is consisted of: - a color, in the format 0xRRGGBB, for instance red: 0xFF0000. - led on = length of time, in seconds, to keep the light on. - led off = length of time, in seconds, to keep the light off. -- The "Show only when in background" setting. This is available only on Android. On iOS the user sees the notification only -if the application is running in background. On Android this can be configured: by checking this setting the notification -will be displayed only if the app is running in background. By un-checking it you will get the notification regardless of the -focus state. The last setting is the fire date: number of seconds for scheduling. From d78472d81a45000cfc7ec79df481f55e22adb212 Mon Sep 17 00:00:00 2001 From: Spiridon Alexandru Date: Wed, 6 Mar 2013 16:28:38 +0200 Subject: [PATCH 09/12] MOSYNC-2884: - fixed - the crash was due to a string to double conversion: on Lumia 920, '.' was not considered as a separator of the integer and fractional part of the number so the resulting parsed double value was very large and setting a label font size to a very large value lead to an unhandled exception -> a crash. The parsing now takes into consideration the dot as a separator. --- .../mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs index dc114801d..2831a7cb2 100644 --- a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs +++ b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs @@ -16,6 +16,7 @@ using System.Text.RegularExpressions; using System.Reflection; using System.Windows.Media; +using System.Globalization; namespace MoSync { @@ -207,7 +208,9 @@ public String fontSize set { double size = 0; - if (double.TryParse(value, out size)) + NumberStyles style = NumberStyles.AllowDecimalPoint; + IFormatProvider provider = CultureInfo.InvariantCulture; + if (Double.TryParse(value, style, provider, out size)) { // for some values better use the default size of the platform mLabel.FontSize = size <= 0 ? 11 : size; From e192611559b78bfeee4cc9d6f25def8c25a50162 Mon Sep 17 00:00:00 2001 From: Eric Svensson Date: Wed, 6 Mar 2013 16:10:34 +0100 Subject: [PATCH 10/12] [WORMHOLE-3] Push Notification callback receives message string with correct escaping --- .../Notification/PushNotificationManager.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libs/Wormhole/Libs/Notification/PushNotificationManager.cpp b/libs/Wormhole/Libs/Notification/PushNotificationManager.cpp index 1666ceaa9..b1c69365d 100644 --- a/libs/Wormhole/Libs/Notification/PushNotificationManager.cpp +++ b/libs/Wormhole/Libs/Notification/PushNotificationManager.cpp @@ -144,18 +144,25 @@ namespace Wormhole sprintf( data, - "\\'{\"message\": \"%s\"," + "{\"message\": %s," "\"sound\": \"%s\"," - "\"iconBadge\":\"%d\"}\\'", - message.c_str(), + "\"iconBadge\":\"%d\"}", + Encoder::JSONStringify(message.c_str()).c_str(), sound.c_str(), iconBadge); - mMessageHandler->callSuccess( - mListenerCallBack, - PHONEGAP_CALLBACK_STATUS_OK, - data, - true); + String args = ""; + args += "{"; + args += "\"status\":" + ((MAUtil::String) PHONEGAP_CALLBACK_STATUS_OK); + args += ",\"message\":" + Encoder::JSONStringify(data); + args += ",\"keepCallback\":true"; + args += "}"; + + String script = "PhoneGap.CallbackSuccess("; + script += "'" + mListenerCallBack + "',"; + script += Encoder::JSONStringify(args.c_str()) + ")"; + + mMessageHandler->callJS(script); } /** From d2115ae0c238f443bd8dbe876b2d5ac7feb31359 Mon Sep 17 00:00:00 2001 From: Spiridon Alexandru Date: Thu, 7 Mar 2013 16:28:21 +0200 Subject: [PATCH 11/12] MOSYNC-2884: small code review issue fixed --- .../mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs index 81d2c1bfb..0c73f4edf 100644 --- a/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs +++ b/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncMap.cs @@ -60,8 +60,6 @@ public class Map : WidgetBaseWindowsPhone // used to center the map on an area described by the upper left corner and the lower right corner System.Device.Location.GeoCoordinate mVisibleAreaLowerRightCorner; - private CredentialsProvider mCredentialsProvider; - /** * Constructor */ @@ -151,8 +149,7 @@ public string ApiKey { set { - mCredentialsProvider = new ApplicationIdCredentialsProvider(value); - mBingMap.CredentialsProvider = mCredentialsProvider; + mBingMap.CredentialsProvider = new ApplicationIdCredentialsProvider(value); } } From 6403e74fab134b799ff3b755d4e30a6302205d32 Mon Sep 17 00:00:00 2001 From: Anders Malm Date: Thu, 7 Mar 2013 15:31:43 +0100 Subject: [PATCH 12/12] 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);