unsigned int tid;
bool suspended_state;
bool allowed_bg;
+ bool dirty;
} appcore_base_context;
typedef struct _appcore_base_event_node {
EXPORT_API int appcore_base_init(appcore_base_ops ops, int argc, char **argv, void *data)
{
+ int i;
+
__context.ops = ops;
__context.argc = argc;
__context.argv = argv;
__init_suspend_dbus_handler();
+ if (!__context.dirty) {
+ __context.dirty = true;
+
+ for (i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
+ if (__exist_callback(i)) {
+ if (__context.ops.set_event)
+ __context.ops.set_event(i, __context.data);
+ }
+ }
+ }
+
if (__context.ops.create && __context.ops.create(__context.data) < 0) {
aul_status_update(STATUS_DYING);
return 0;
{
int i;
+ aul_status_update(STATUS_DYING);
+ if (__context.ops.terminate)
+ __context.ops.terminate(__context.data);
+
for (i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
if (__exist_callback(i)) {
if (__context.ops.unset_event)
__events = NULL;
__fini_suspend_dbus_handler();
- aul_status_update(STATUS_DYING);
- if (__context.ops.terminate)
- __context.ops.terminate(__context.data);
-
if (__locale_dir) {
free(__locale_dir);
__locale_dir = NULL;
}
+
+ __context.dirty = false;
}
EXPORT_API int appcore_base_flush_memory(void)
{
appcore_base_event_node *node;
- if (!__exist_callback(event)) {
+ if (__context.dirty && !__exist_callback(event)) {
if (__context.ops.set_event)
__context.ops.set_event(event, __context.data);
}
event = node->type;
__events = g_list_remove(__events, node);
free(node);
- if (!__exist_callback(event)) {
+ if (__context.dirty && !__exist_callback(event)) {
if (__context.ops.unset_event)
__context.ops.unset_event(event, __context.data);
}