From: Jaehyun Cho Date: Mon, 20 May 2019 05:38:04 +0000 (+0900) Subject: [CONPRO-1442] Fix crash in cpp wrapper. X-Git-Tag: accepted/tizen/unified/20190626.040955~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fiotivity.git;a=commitdiff_plain;h=57a5cd3ae30e0f63d0d5a8258a19f46539da8d72 [CONPRO-1442] Fix crash in cpp wrapper. When application is run with Both mode, in InProcClientWrapper start logic for making procession thread is not executed. But, when stop application, thread join processing and event free logic is executed regardless mode. So I moved that logic into mode check statement. This can make that logic is executed only mode is client. https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/b5c0bd60cef0c305dfb07239cbfbd3529a39afec (cherry picked from b5c0bd60cef0c305dfb07239cbfbd3529a39afec) Change-Id: I713f0019051f4970d6122e458186795fd070112e Signed-off-by: Jaehyun Cho Signed-off-by: DoHyun Pyun --- diff --git a/resource/src/InProcClientWrapper.cpp b/resource/src/InProcClientWrapper.cpp index 0dfc3b6..132d082 100755 --- a/resource/src/InProcClientWrapper.cpp +++ b/resource/src/InProcClientWrapper.cpp @@ -98,30 +98,29 @@ namespace OC { OIC_LOG(INFO, TAG, "stop ocplatform"); - if (m_threadRun && m_listeningThread.joinable()) + // only stop if we are the ones who actually called 'start'. We are counting + // on the server to do the stop. + if (m_cfg.mode == ModeType::Client) { - m_threadRun = false; -#ifdef WITH_PROCESS_EVENT - if (m_processEvent) + if (m_threadRun && m_listeningThread.joinable()) { - oc_event_signal(m_processEvent); - } + m_threadRun = false; +#ifdef WITH_PROCESS_EVENT + if (m_processEvent) + { + oc_event_signal(m_processEvent); + } #endif - m_listeningThread.join(); - } + m_listeningThread.join(); + } #ifdef WITH_PROCESS_EVENT - if (m_processEvent) - { - oc_event_free(m_processEvent); - m_processEvent = NULL; - } + if (m_processEvent) + { + oc_event_free(m_processEvent); + m_processEvent = NULL; + } #endif - - // only stop if we are the ones who actually called 'start'. We are counting - // on the server to do the stop. - if (m_cfg.mode == ModeType::Client) - { OCStackResult result = OCStop(); if (OC_STACK_OK != result)