Apply shallow copy to the NDEF message detection event.
authorWoowon <woowon.park@samsung.com>
Wed, 20 Mar 2013 07:28:08 +0000 (16:28 +0900)
committerWoowon <woowon.park@samsung.com>
Wed, 20 Mar 2013 07:28:08 +0000 (16:28 +0900)
Change-Id: Iffcba63150ab641500321320cee02df522cac17f
Signed-off-by: Woowon <woowon.park@samsung.com>
src/FNetNfc_NdefMessageDiscoveryEvent.cpp

index 96c7dce..8dcc741 100644 (file)
@@ -68,19 +68,18 @@ _NdefMessageDiscoveryEvent::FireImpl(IEventListener& listener, const IEventArg&
 
        // If the numuber of the registered listeners is only one - most of cases, do shallow copy for better performance.
        // Otherwise, do deep copy.
-       // TODO: the following code should be applied after testing _Event::GetListenerCount() to work fine
-//     if (_Event::GetListenerCount() == 1)
-//     {
-//             pDstMessage = _NdefMessageImpl::GetCloneSharingPayloadN(*pSrcMessage);
-//             SysTryReturnVoidResult(NID_NET_NFC, pDstMessage != null, GetLastResult(),
-//                             "[%s] Copying an NDEF message failed.", GetErrorMessage(GetLastResult()));
-//     }
-//     else
-//     {
+       if (_Event::GetListenerCount() == 1)
+       {
+               pDstMessage = _NdefMessageImpl::GetCloneSharingPayloadN(*pSrcMessage);
+               SysTryReturnVoidResult(NID_NET_NFC, pDstMessage != null, GetLastResult(),
+                               "[%s] Copying an NDEF message failed.", GetErrorMessage(GetLastResult()));
+       }
+       else
+       {
                pDstMessage = new (std::nothrow) NdefMessage(*pSrcMessage); // deep copy
                SysTryReturnVoidResult(NID_NET_NFC, pDstMessage != null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] Memory allocation failed.");
-//     }
+       }
 
        pEventListener->OnNdefMessageDetectedN(pDstMessage); // transfer the ownershipt to the listener
 }