From: Piotr Kosko
Date: Fri, 18 Sep 2015 10:46:51 +0000 (+0200)
Subject: [Content] additional check for registering listeners
X-Git-Tag: submit/tizen/20151026.073646^2^2~94
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9a6fd7a6f7f3861d36ad1779de6b00a9fbdb309;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Content] additional check for registering listeners
[Feature] Additional check prevents multiple registering listener in native code.
[Verification] Code compiles without errors.
Checked in chrome console.
TCT passrate with corrected ContentChangeCallback_oncontentdirupdated test is 100%.
Change-Id: I78eb3526ae7a14e6f8f6bee57ffce677e600724e
Signed-off-by: Piotr Kosko
---
diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc
index f06efa81..18d9f5c1 100755
--- a/src/content/content_manager.cc
+++ b/src/content/content_manager.cc
@@ -867,13 +867,13 @@ PlatformResult ContentManager::setV2ChangeListener(media_content_noti_h* noti_ha
media_content_db_update_cb callback,
void *user_data) {
LoggerD("Enter");
-
- int ret = media_content_set_db_updated_cb_v2(noti_handle, callback, user_data);
- if(ret != MEDIA_CONTENT_ERROR_NONE) {
- LoggerE("Failed: registering the listener of cb_v2 is failed");
- return PlatformResult(ErrorCode::UNKNOWN_ERR, ("registering the listener is failed."));
+ if (nullptr == *noti_handle) {
+ int ret = media_content_set_db_updated_cb_v2(noti_handle, callback, user_data);
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
+ LoggerE("Failed: registering the listener of cb_v2 is failed");
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, ("registering the listener is failed."));
+ }
}
-
return PlatformResult(ErrorCode::NO_ERROR);
}