From: Hosang Kim Date: Fri, 9 Jul 2021 08:00:56 +0000 (+0900) Subject: libaurum: fix critical error on glib. X-Git-Tag: accepted/tizen/unified/20210712.055211^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F261058%2F3;p=platform%2Fcore%2Fuifw%2Faurum.git libaurum: fix critical error on glib. Change-Id: Ied81da3a54afa8cd844835778a873af0f70ed849 --- diff --git a/libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc b/libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc index 79de9e0..544c56d 100644 --- a/libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc +++ b/libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc @@ -93,8 +93,9 @@ static gpointer _event_thread_loop (gpointer data) AtspiAccessibleWatcher::AtspiAccessibleWatcher() : mDbusProxy{nullptr} { - GVariant *enabled_variant = nullptr, *result = nullptr; + GVariant *result = nullptr; GError *error = nullptr; + atspi_set_main_context (g_main_context_default ()); atspi_init(); @@ -106,32 +107,28 @@ AtspiAccessibleWatcher::AtspiAccessibleWatcher() "org.a11y.Bus", "/org/a11y/bus", "org.freedesktop.DBus.Properties", NULL, &error); - enabled_variant = g_variant_new_boolean(true); result = g_dbus_proxy_call_sync( mDbusProxy, "Set", - g_variant_new("(ssv)", "org.a11y.Status", "IsEnabled", enabled_variant), + g_variant_new("(ssv)", "org.a11y.Status", "IsEnabled", g_variant_new_boolean(true)), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); - g_variant_unref(enabled_variant); g_variant_unref(result); - g_error_free(error); + if (error) g_error_free(error); } AtspiAccessibleWatcher::~AtspiAccessibleWatcher() { - GVariant *enabled_variant = nullptr, *result = nullptr; + GVariant *result = nullptr; GError *error = nullptr; - enabled_variant = g_variant_new_boolean(false); result = g_dbus_proxy_call_sync( mDbusProxy, "Set", - g_variant_new("(ssv)", "org.a11y.Status", "IsEnabled", enabled_variant), + g_variant_new("(ssv)", "org.a11y.Status", "IsEnabled", g_variant_new_boolean(false)), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); g_object_unref(mDbusProxy); - g_variant_unref(enabled_variant); g_variant_unref(result); - g_error_free(error); + if (error) g_error_free(error); atspi_event_quit(); g_thread_join(mEventThread);