summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHawnkyu Jhun <h.jhun@samsung.com>2016-07-17 16:23:54 +0900
committerHawnkyu Jhun <h.jhun@samsung.com>2016-07-17 16:23:54 +0900
commit73f688b07dab4d695cc1f7bee4eec6701500eab4 (patch)
tree4fc4d63d50315f1b134e7ee502998c6155329e01
parent7a918d29b0a1c9e7eba774c79bb3c0e28051e313 (diff)
downloadapp-core-73f688b07dab4d695cc1f7bee4eec6701500eab4.tar.gz
app-core-73f688b07dab4d695cc1f7bee4eec6701500eab4.tar.bz2
app-core-73f688b07dab4d695cc1f7bee4eec6701500eab4.zip
Change-Id: I55430096980d19d0be6791edbb8b564cb2bc44c0 Signed-off-by: Hawnkyu Jhun <h.jhun@samsung.com>
-rw-r--r--include/appcore-internal.h3
-rw-r--r--src/appcore.c28
2 files changed, 24 insertions, 7 deletions
diff --git a/include/appcore-internal.h b/include/appcore-internal.h
index 7bd3db8..f16c214 100644
--- a/include/appcore-internal.h
+++ b/include/appcore-internal.h
@@ -194,9 +194,6 @@ unsigned int appcore_get_main_window(void);
unsigned int appcore_get_main_surface(void);
#endif
void appcore_get_app_core(struct appcore **ac);
-#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
-int _appcore_init_suspend_dbus_handler(void *data);
-#endif
#define ENV_START "APP_START_TIME"
diff --git a/src/appcore.c b/src/appcore.c
index 4e47998..144f15d 100644
--- a/src/appcore.c
+++ b/src/appcore.c
@@ -39,6 +39,9 @@
#define RESOURCED_FREEZER_PATH "/Org/Tizen/Resourced/Freezer"
#define RESOURCED_FREEZER_INTERFACE "org.tizen.resourced.freezer"
#define RESOURCED_FREEZER_SIGNAL "FreezerState"
+
+int __appcore_init_suspend_dbus_handler(void *data);
+void __appcore_fini_suspend_dbus_handler(void);
#endif
#define SQLITE_FLUSH_MAX (1024*1024)
@@ -136,8 +139,8 @@ static struct evt_ops evtops[] = {
};
#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
-static GDBusConnection *bus = NULL;
-static guint __suspend_dbus_handler_initialized = 0;
+static GDBusConnection *bus;
+static guint __suspend_dbus_handler_initialized;
#endif
static int __get_locale_resource_dir(char *locale_dir, int size)
@@ -657,7 +660,7 @@ static gboolean __init_suspend(gpointer data)
{
int r;
- r = _appcore_init_suspend_dbus_handler(&core);
+ r = __appcore_init_suspend_dbus_handler(&core);
if (r == -1) {
_ERR("Initailzing suspended state handler failed");
}
@@ -726,6 +729,7 @@ EXPORT_API void appcore_exit(void)
__clear(&core);
#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
__remove_suspend_timer(&core);
+ __appcore_fini_suspend_dbus_handler();
#endif
}
aul_finalize();
@@ -789,7 +793,7 @@ static void __suspend_dbus_signal_handler(GDBusConnection *connection,
}
}
-int _appcore_init_suspend_dbus_handler(void *data)
+int __appcore_init_suspend_dbus_handler(void *data)
{
GError *err = NULL;
@@ -826,4 +830,20 @@ int _appcore_init_suspend_dbus_handler(void *data)
return 0;
}
+
+void __appcore_fini_suspend_dbus_handler(void)
+{
+ if (bus == NULL)
+ return;
+
+ if (__suspend_dbus_handler_initialized) {
+ g_dbus_connection_signal_unsubscribe(bus,
+ __suspend_dbus_handler_initialized);
+ __suspend_dbus_handler_initialized = 0;
+ }
+
+ g_object_unref(bus);
+ bus = NULL;
+}
#endif
+