Remove remained idle callback when destroy handle 84/159984/1 accepted/tizen/unified/20171116.060648 submit/tizen/20171115.073701
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 14 Nov 2017 04:43:06 +0000 (13:43 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 14 Nov 2017 04:43:06 +0000 (13:43 +0900)
The crash could be occurred if idle callback is called after so is unloaded.
To avoid it, remove not-called idle event when destroy handle.

[Version] 0.3.11
[Profile] Common
[Issue Type] Bug fix
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20171107.4]

Change-Id: Icecce81cc7e8217beffd112733bc68e6170f0240
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-camera.spec
src/camera.c

index b2b5775..b7fa839 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.3.10
+Version:    0.3.11
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index e5c2403..2ef7034 100644 (file)
@@ -1841,6 +1841,20 @@ static void _camera_deactivate_idle_event_all(camera_cb_info_s *cb_info)
                        continue;
                }
 
+               if (g_idle_remove_by_data(cam_idle_event)) {
+                       LOGW("remove idle event %p done", cam_idle_event);
+
+                       cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
+
+                       g_mutex_clear(&cam_idle_event->event_mutex);
+                       g_free(cam_idle_event);
+                       cam_idle_event = NULL;
+
+                       continue;
+               }
+
+               LOGW("remove idle event %p failed", cam_idle_event);
+
                if (!g_mutex_trylock(&cam_idle_event->event_mutex)) {
                        LOGW("lock failed, %p event is calling now", cam_idle_event);
 
@@ -2762,6 +2776,8 @@ int camera_destroy(camera_h camera)
                pc = NULL;
        }
 
+       LOGD("ret : 0x%x", ret);
+
        return ret;
 }