summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSemun Lee <sm79.lee@samsung.com>2016-07-05 21:14:55 +0900
committerSemun Lee <sm79.lee@samsung.com>2016-07-06 11:25:47 +0900
commit8f4d0f73e47345a9b15faa1fd756d7d5f70d6c62 (patch)
tree5097bbcf2a030b006deef068e5f0e69bebcade3c
parentcf685c91b13551578e6644d905ff562f451801f6 (diff)
downloadshortcut-8f4d0f73e47345a9b15faa1fd756d7d5f70d6c62.tar.gz
shortcut-8f4d0f73e47345a9b15faa1fd756d7d5f70d6c62.tar.bz2
shortcut-8f4d0f73e47345a9b15faa1fd756d7d5f70d6c62.zip
Fix crash when ui-gadget unloads shortcut modulesubmit/tizen/20160706.043533
Passing static variable string to g_dbus_error_register_error_domain may cause crash after ui-gadget unloads shortcut module. Change-Id: I0f76fe64f6b753f0b8f1bbeb1662b01686f0870b Signed-off-by: Semun Lee <sm79.lee@samsung.com>
-rwxr-xr-xlib/src/shortcut_manager.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/src/shortcut_manager.c b/lib/src/shortcut_manager.c
index 002adec..6c43266 100755
--- a/lib/src/shortcut_manager.c
+++ b/lib/src/shortcut_manager.c
@@ -74,10 +74,26 @@ static shortcut_cb_info _callback_info;
static int _dbus_init();
static char *_shortcut_get_pkgname_by_pid(void);
+#define SHORTCUT_ERROR_QUARK "shortcut-error-quark"
+
EXPORT_API GQuark shortcut_error_quark(void)
{
static volatile gsize quark_volatile = 0;
- g_dbus_error_register_error_domain("shortcut-error-quark",
+ static char *domain_name = NULL;
+
+ /* This is for preventing crash when notification api is used in ui-gadget */
+ /* ui-gadget libraries can be unloaded when it is needed and the static string */
+ /* parameter to g_dbus_error_register_error_domain may cause crash. */
+ GQuark quark = g_quark_try_string(SHORTCUT_ERROR_QUARK);
+
+ if (quark == 0) {
+ if (domain_name == NULL)
+ domain_name = strdup(SHORTCUT_ERROR_QUARK);
+ } else {
+ domain_name = SHORTCUT_ERROR_QUARK;
+ }
+
+ g_dbus_error_register_error_domain(domain_name,
&quark_volatile,
dbus_error_entries,
G_N_ELEMENTS(dbus_error_entries));