From d9a6fd7a6f7f3861d36ad1779de6b00a9fbdb309 Mon Sep 17 00:00:00 2001
From: Piotr Kosko
Date: Fri, 18 Sep 2015 12:46:51 +0200
Subject: [PATCH] [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
---
src/content/content_manager.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
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);
}
--
2.34.1