projects
/
platform
/
core
/
appfw
/
app-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug about setting event handler
[platform/core/appfw/app-core.git]
/
src
/
base
/
appcore_base.c
diff --git
a/src/base/appcore_base.c
b/src/base/appcore_base.c
index
93e2f56
..
7a15b33
100644
(file)
--- a/
src/base/appcore_base.c
+++ b/
src/base/appcore_base.c
@@
-51,6
+51,7
@@
typedef struct _appcore_base_context {
unsigned int tid;
bool suspended_state;
bool allowed_bg;
unsigned int tid;
bool suspended_state;
bool allowed_bg;
+ bool dirty;
} appcore_base_context;
typedef struct _appcore_base_event_node {
} appcore_base_context;
typedef struct _appcore_base_event_node {
@@
-683,6
+684,8
@@
EXPORT_API int appcore_base_on_set_i18n(void)
EXPORT_API int appcore_base_init(appcore_base_ops ops, int argc, char **argv, void *data)
{
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;
__context.ops = ops;
__context.argc = argc;
__context.argv = argv;
@@
-696,6
+699,17
@@
EXPORT_API int appcore_base_init(appcore_base_ops ops, int argc, char **argv, vo
__init_suspend_dbus_handler();
__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;
if (__context.ops.create && __context.ops.create(__context.data) < 0) {
aul_status_update(STATUS_DYING);
return 0;
@@
-711,6
+725,10
@@
EXPORT_API void appcore_base_fini(void)
{
int i;
{
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)
for (i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
if (__exist_callback(i)) {
if (__context.ops.unset_event)
@@
-722,14
+740,12
@@
EXPORT_API void appcore_base_fini(void)
__events = NULL;
__fini_suspend_dbus_handler();
__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;
}
if (__locale_dir) {
free(__locale_dir);
__locale_dir = NULL;
}
+
+ __context.dirty = false;
}
EXPORT_API int appcore_base_flush_memory(void)
}
EXPORT_API int appcore_base_flush_memory(void)
@@
-917,7
+933,7
@@
EXPORT_API appcore_base_event_h appcore_base_add_event(enum appcore_base_event e
{
appcore_base_event_node *node;
{
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);
}
if (__context.ops.set_event)
__context.ops.set_event(event, __context.data);
}
@@
-943,7
+959,7
@@
EXPORT_API int appcore_base_remove_event(appcore_base_event_h handle)
event = node->type;
__events = g_list_remove(__events, node);
free(node);
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);
}
if (__context.ops.unset_event)
__context.ops.unset_event(event, __context.data);
}