Remove remained idle callback when destroy handle 74/159874/1 accepted/tizen/4.0/unified/20171116.060604 submit/tizen_4.0/20171115.073622
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 13 Nov 2017 08:18:33 +0000 (17:18 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 13 Nov 2017 10:29:47 +0000 (19:29 +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.7
[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: Ia8ea896a6fde6ab2376849e7cae5542814f39862
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-recorder.spec
src/recorder.c

index 88d7918cebd037e38a9e5aab9db541f0fa32df2f..d2e24667b2e0a863ee67b3251881e0460d29032e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-recorder
 Summary:    A Recorder API
-Version:    0.3.6
+Version:    0.3.7
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 614ebccd153134ebc3df7f9731efe839ab1e510d..c7b1fc988cd3a3605315c9925329bc30233abaf2 100644 (file)
@@ -512,6 +512,20 @@ static void _recorder_deactivate_idle_event_all(recorder_cb_info_s *cb_info)
                                continue;
                        }
 
+                       if (g_idle_remove_by_data(rec_idle_event)) {
+                               LOGW("remove idle event %p done", rec_idle_event);
+
+                               cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)rec_idle_event);
+
+                               g_mutex_clear(&rec_idle_event->event_mutex);
+                               g_free(rec_idle_event);
+                               rec_idle_event = NULL;
+
+                               continue;
+                       }
+
+                       LOGW("remove idle event %p failed", rec_idle_event);
+
                        if (!g_mutex_trylock(&rec_idle_event->event_mutex)) {
                                LOGW("lock failed, %p event is calling now", rec_idle_event);