Add to initialize scan_thread_quit_timer and check handle not null 15/60715/1 accepted/tizen/common/20160302.193849 accepted/tizen/ivi/20160302.224357 accepted/tizen/mobile/20160302.224311 accepted/tizen/tv/20160302.224326 accepted/tizen/wearable/20160302.224340 submit/tizen/20160302.080833
authorJi Yong Min <jiyong.min@samsung.com>
Wed, 2 Mar 2016 01:19:03 +0000 (10:19 +0900)
committerJi Yong Min <jiyong.min@samsung.com>
Wed, 2 Mar 2016 01:21:54 +0000 (10:21 +0900)
Change-Id: I2316593aa13b88af3fb267a06f8ec024ede12719
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
libdcm-face/dcm-face_mediavision.c
packaging/dcm-service.spec
src/DcmScanSvc.cpp

index 153829df9eb62837c0989146e8bdd754b58cd79f..c096bd4eb8bdf5e696731b55c93ca1b4eedc7957 100755 (executable)
@@ -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");
 
index 7a6491747910cacdc9f3d8c00ccdceff56dd3928..c14c4f7af11dfcbc60e8cd40cf9cf03d0ed492ad 100755 (executable)
@@ -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
index 5f6a0d40580a29f76df621b93ba4ad9aa20794de..3094b734984f97828c4218dffc12640bad80d22e 100755 (executable)
@@ -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();