From: Ji Yong Min Date: Wed, 2 Mar 2016 01:19:03 +0000 (+0900) Subject: Add to initialize scan_thread_quit_timer and check handle not null X-Git-Tag: submit/tizen/20160302.080833^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93c098b1c64d1880ecdb7ac94bc228e3fddadc3d;p=platform%2Fcore%2Fmultimedia%2Fdcm-service.git Add to initialize scan_thread_quit_timer and check handle not null Change-Id: I2316593aa13b88af3fb267a06f8ec024ede12719 Signed-off-by: Jiyong Min --- diff --git a/libdcm-face/dcm-face_mediavision.c b/libdcm-face/dcm-face_mediavision.c index 153829d..c096bd4 100755 --- a/libdcm-face/dcm-face_mediavision.c +++ b/libdcm-face/dcm-face_mediavision.c @@ -166,18 +166,24 @@ int _face_handle_destroy(__in void *handle) mv_handle* _handle = (mv_handle*)handle; + dcm_retvm_if(_handle == NULL, FACE_ERROR_INVALID_PARAMTER, "invalid handle"); + dcm_info("dcm_face_engine destroy. handle=0x%08x", handle); - err = mv_destroy_engine_config(_handle->cfg); - if (err != MEDIA_VISION_ERROR_NONE) { - dcm_error("Fail to mv_destroy_engine_config"); - return __convert_to_mv_error_e(err); + if (_handle->cfg != NULL) { + err = mv_destroy_engine_config(_handle->cfg); + if (err != MEDIA_VISION_ERROR_NONE) { + dcm_error("Fail to mv_destroy_engine_config"); + return __convert_to_mv_error_e(err); + } } - err = mv_destroy_source(_handle->source); - if (err != MEDIA_VISION_ERROR_NONE) { - dcm_error("Fail to mv_destroy_source"); - return __convert_to_mv_error_e(err); + if (_handle->source != NULL) { + err = mv_destroy_source(_handle->source); + if (err != MEDIA_VISION_ERROR_NONE) { + dcm_error("Fail to mv_destroy_source"); + return __convert_to_mv_error_e(err); + } } return FACE_ERROR_NONE; @@ -190,6 +196,7 @@ int _face_detect_faces(__in dcm_face_h handle, __out face_rect_s *face_rect[], _ mv_faceInfo result; dcm_retvm_if(handle == NULL, FACE_ERROR_OUT_OF_MEMORY, "invalid handle"); + dcm_retvm_if(handle->fengine == NULL, FACE_ERROR_OUT_OF_MEMORY, "invalid handle"); dcm_retvm_if(face_rect == NULL, FACE_ERROR_OUT_OF_MEMORY, "invalid face_rect"); dcm_retvm_if(count == NULL, FACE_ERROR_OUT_OF_MEMORY, "invalid count"); diff --git a/packaging/dcm-service.spec b/packaging/dcm-service.spec index 7a64917..c14c4f7 100755 --- a/packaging/dcm-service.spec +++ b/packaging/dcm-service.spec @@ -1,6 +1,6 @@ Name: dcm-service Summary: A media DCM(Digital Contents Management) Service -Version: 0.0.6 +Version: 0.0.7 Release: 0 Group: Multimedia/Service License: Apache-2.0 diff --git a/src/DcmScanSvc.cpp b/src/DcmScanSvc.cpp index 5f6a0d4..3094b73 100755 --- a/src/DcmScanSvc.cpp +++ b/src/DcmScanSvc.cpp @@ -126,8 +126,6 @@ gboolean DcmScanCallback::quitTimerAtScanThread(gpointer data) int DcmScanSvc::createQuitTimerScanThread() { - GSource *quit_timer = NULL; - dcm_debug_fenter(); if (scan_thread_quit_timer != NULL) { @@ -136,12 +134,11 @@ int DcmScanSvc::createQuitTimerScanThread() scan_thread_quit_timer = NULL; } - quit_timer = g_timeout_source_new_seconds(DCM_SVC_SCAN_THREAD_TIMEOUT_SEC); - DCM_CHECK_VAL(quit_timer, DCM_ERROR_OUT_OF_MEMORY); + scan_thread_quit_timer = g_timeout_source_new_seconds(DCM_SVC_SCAN_THREAD_TIMEOUT_SEC); + DCM_CHECK_VAL(scan_thread_quit_timer, DCM_ERROR_OUT_OF_MEMORY); - g_source_set_callback(quit_timer, DcmScanCallback::quitTimerAtScanThread, (gpointer)this, NULL); - g_source_attach(quit_timer, scan_thread_main_context); - scan_thread_quit_timer = quit_timer; + g_source_set_callback(scan_thread_quit_timer, DcmScanCallback::quitTimerAtScanThread, (gpointer)this, NULL); + g_source_attach(scan_thread_quit_timer, scan_thread_main_context); dcm_debug_fleave(); @@ -260,6 +257,7 @@ int DcmScanSvc::initialize() scan_single_item_list = NULL; scan_single_curr_index = 0; g_scan_cancel = FALSE; + scan_thread_quit_timer = NULL; DcmFaceUtils::initialize(); dcmDBUtils = DcmDbUtils::getInstance();