[Messaging] Prevent crash on getMessageServices call
Calling tizen.messaging.getMessageServices() multiple times at
short intervals used to cause a crash, due to race condition, occurring
between different threads, modifying the same MessagingManager
instance's fields.
The fix moves execution of the underlying implementation to the main
thread - it is not called concurrently. The function execution time
is typically below 2 ms, so moving it to the main thread should
not worsen user experience.
[Verification] tct-tizen-messaging-email-tests pass rate: 100%
tct-tizen-messaging-sms-tests pass rate: 100%
tct-tizen-messaging-mms-tests pass rate: 100%
A code snippet, that used to cause a crash, does not
cause crash now:
for (var i = 0; i < 1000; ++i) {
tizen.messaging.getMessageServices('messaging.email',
s=>{console.log(s);},
e=>{console.error(e);});
}
Change-Id: I2f140281e64aeffea1ad9ca15f99ee38378693d3
Signed-off-by: Pawel Wasowski <p.wasowski2@partner.samsung.com>