Fix wrong list 14/317014/1
authorinkyun.kil <inkyun.kil@samsung.com>
Mon, 23 Dec 2024 05:39:38 +0000 (14:39 +0900)
committerinkyun.kil <inkyun.kil@samsung.com>
Mon, 23 Dec 2024 05:39:38 +0000 (14:39 +0900)
- Empty data can be appended to the list

Change-Id: Ia5fe990fa76b74acf5fbc978eaf3988511967d85
Signed-off-by: inkyun.kil <inkyun.kil@samsung.com>
src/eventsystem.c

index fbbc172842e4fa37ecb0f24684239113373d6d45..c3074e8ae3a8de21c4a3cf757ffc68c5604dd053 100644 (file)
@@ -2208,9 +2208,6 @@ API int eventsystem_register_application_event(const char *event_name,
                em->bus_type = bus_type;
                em->reg_id = subscription_id;
 
-               system_event_list = g_list_append(system_event_list, em);
-               *reg_id = subscription_id;
-
                ret = ES_R_OK;
 
                if (em->bus_type == G_BUS_TYPE_SESSION &&
@@ -2231,6 +2228,12 @@ API int eventsystem_register_application_event(const char *event_name,
                                }
                        }
                }
+
+               if (ret == ES_R_OK) {
+                       system_event_list = g_list_append(system_event_list, em);
+                       *reg_id = subscription_id;
+               }
+
        } else {
                _E("dbus subscribe: error(%d)", subscription_id);
                __destroy_eventmap(em);