Fix bug in alarmmgr_fini accepted/tizen/common/20170112.174805 accepted/tizen/ivi/20170112.222949 accepted/tizen/mobile/20170112.222856 accepted/tizen/tv/20170112.222913 accepted/tizen/wearable/20170112.222929 submit/tizen/20170112.062520
authorJiwoong Im <jiwoong.im@samsung.com>
Thu, 29 Dec 2016 09:36:25 +0000 (18:36 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 4 Jan 2017 22:47:40 +0000 (07:47 +0900)
- Some finalize step for session bus connection is missing.

Change-Id: Iaf033059e35efcdedadab05bb8e305825086b0c1
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
src/alarm-lib.c

index f721c8a..01e7325 100644 (file)
@@ -596,13 +596,20 @@ error:
 EXPORT_API void alarmmgr_fini()
 {
        SECURE_LOGD("Enter");
+       bool is_user = false;
+
+       if (getuid() >= REGULAR_UID_MIN)
+               is_user = true;
+
        if (introspection_data) {
                g_dbus_node_info_unref(introspection_data);
                introspection_data = NULL;
        }
 
-       if (alarm_context.connection != NULL && registration_id != 0) {
-               g_dbus_connection_unregister_object(alarm_context.connection, registration_id);
+       if (registration_id != 0) {
+               g_dbus_connection_unregister_object(is_user ?
+                               alarm_context.session_conn : alarm_context.connection,
+                               registration_id);
                registration_id = 0;
        }
 
@@ -616,7 +623,7 @@ EXPORT_API void alarmmgr_fini()
                alarm_context.connection = NULL;
        }
 
-       if (alarm_context.connection) {
+       if (alarm_context.session_conn) {
                g_object_unref(alarm_context.session_conn);
                alarm_context.session_conn = NULL;
        }