From ecdbe08878bbbbcf8b8e93269d0dd29bf73472b2 Mon Sep 17 00:00:00 2001 From: Jaewook Jung Date: Tue, 30 Aug 2016 18:29:33 +0900 Subject: [PATCH] fix bug on JniOnObserveListener related to AccountManager Change-Id: I5d5f77838c66aff4cfe1c4bbf7d04d5386a222f2 Signed-off-by: Jaewook Jung Reviewed-on: https://gerrit.iotivity.org/gerrit/11129 Tested-by: jenkins-iotivity Reviewed-by: Jaehong Jo Reviewed-by: Jon A. Cruz --- android/android_api/base/jni/JniOnObserveListener.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/android/android_api/base/jni/JniOnObserveListener.cpp b/android/android_api/base/jni/JniOnObserveListener.cpp index 1bb3c23..060b19e 100644 --- a/android/android_api/base/jni/JniOnObserveListener.cpp +++ b/android/android_api/base/jni/JniOnObserveListener.cpp @@ -166,7 +166,18 @@ void JniOnObserveListener::onObserveCallback(const HeaderOptions headerOptions, env->DeleteLocalRef(jHeaderOptionList); jthrowable ex = env->ExceptionOccurred(); env->ExceptionClear(); +#ifndef WITH_CLOUD m_ownerResource->removeOnObserveListener(env, m_jwListener); +#else + if (nullptr != m_ownerResource) + { + m_ownerResource->removeOnObserveListener(env, m_jwListener); + } + if (nullptr != m_ownerAccountManager) + { + m_ownerAccountManager->removeOnObserveListener(env, m_jwListener); + } +#endif env->Throw((jthrowable)ex); } -- 2.7.4