summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2016-11-15 18:25:59 +0900
committerMyungki Lee <mk5004.lee@samsung.com>2016-11-15 18:33:36 +0900
commit6656dd70018893adea0ea341f8001e95c691c8e3 (patch)
tree94eb74cef9af4cbf3ad0b3bcaa2948f8f167f8e9 /lib
parentab9c40fbd95b1df4d2fc996b631615384ca3c415 (diff)
downloadshortcut-6656dd70018893adea0ea341f8001e95c691c8e3.tar.gz
shortcut-6656dd70018893adea0ea341f8001e95c691c8e3.tar.bz2
shortcut-6656dd70018893adea0ea341f8001e95c691c8e3.zip
Disconnect the monitor connection when callback unregister
Change-Id: I1a25f04433ec688038c0c176082b92fcf645ddb0 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/src/shortcut_internal.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/src/shortcut_internal.c b/lib/src/shortcut_internal.c
index 26bd565..d8f4238 100755
--- a/lib/src/shortcut_internal.c
+++ b/lib/src/shortcut_internal.c
@@ -429,6 +429,25 @@ static void _on_name_vanished(GDBusConnection *connection,
}
/* LCOV_EXCL_STOP */
+void _ipc_monitor_fini(void)
+{
+ if (provider_monitor_id) {
+ g_bus_unwatch_name(provider_monitor_id);
+ provider_monitor_id = 0;
+ }
+
+ if (monitor_id) {
+ g_dbus_connection_signal_unsubscribe(_gdbus_conn, monitor_id);
+ monitor_id = 0;
+ }
+
+ if (_gdbus_conn) {
+ g_object_unref(_gdbus_conn);
+ _gdbus_conn = NULL;
+ }
+
+}
+
void _set_request_cb(shortcut_request_cb request_cb, void *data)
{
_request_callback_info.request_cb = request_cb;
@@ -437,6 +456,10 @@ void _set_request_cb(shortcut_request_cb request_cb, void *data)
void _unset_request_cb(void)
{
+ if (_remove_callback_info.remove_cb == NULL &&
+ _remove_callback_info.data == NULL)
+ _ipc_monitor_fini();
+
_request_callback_info.request_cb = NULL;
_request_callback_info.data = NULL;
}
@@ -449,6 +472,10 @@ void _set_remove_cb(shortcut_remove_cb remove_cb, void *data)
void _unset_remove_cb(void)
{
+ if (_request_callback_info.request_cb == NULL &&
+ _request_callback_info.data == NULL)
+ _ipc_monitor_fini();
+
_remove_callback_info.remove_cb = NULL;
_remove_callback_info.data = NULL;
}