From: Hwankyu Jhun Date: Thu, 29 Oct 2020 02:47:36 +0000 (+0900) Subject: Fix EmitSignal() method X-Git-Tag: accepted/tizen/6.0/unified/20201110.010746~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eee44dac60a5180ed9598fbc069d8643742574cb;p=platform%2Fcore%2Fapi%2Fnotification.git Fix EmitSignal() method This patch adds g_dbus_connection_flush_sync() call. Change-Id: If2b0f053c0042cb33cabd981907cc6c887921d67 Signed-off-by: Hwankyu Jhun --- diff --git a/notification-ex/dbus_sender.cc b/notification-ex/dbus_sender.cc index ba0d8f9..202a072 100644 --- a/notification-ex/dbus_sender.cc +++ b/notification-ex/dbus_sender.cc @@ -55,27 +55,31 @@ DBusSender::~DBusSender() { bool DBusSender::Impl::EmitSignal(string bus_name, string signal_name, GVariant* data) { - GError* err = NULL; - gboolean result = TRUE; - - result = g_dbus_connection_emit_signal( - DBusConnectionManager::GetInst().GetConnection(), - bus_name.empty() ? NULL : bus_name.c_str(), - path_.c_str(), - DBusConnectionManager::GetInst().GetInterfaceName().c_str(), - signal_name.c_str(), data, &err); + GError* err = nullptr; + GDBusConnection* conn = DBusConnectionManager::GetInst().GetConnection(); + gboolean result = g_dbus_connection_emit_signal(conn, + bus_name.empty() ? NULL : bus_name.c_str(), + path_.c_str(), + DBusConnectionManager::GetInst().GetInterfaceName().c_str(), + signal_name.c_str(), data, &err); if (result == FALSE) { - LOGE("g_dbus_connection_emit_signal() is failed"); - if (err != NULL) { - LOGE("g_dbus_connection_emit_signal() err : %s", - err->message); - g_error_free(err); - } - } else { - LOGI("Successfully emit signal to %s, %s, %s", - bus_name.c_str(), path_.c_str(), signal_name.c_str()); + LOGE("g_dbus_connection_emit_signal() is failed. error(%s)", + err ? err->message : "Unknown"); + g_clear_error(&err); + return false; } - return result; + + result = g_dbus_connection_flush_sync(conn, NULL, &err); + if (result == FALSE) { + LOGE("g_dbus_connection_flush_sync() is failed. error(%s)", + err ? err->message : "Unknown"); + g_clear_error(&err); + return false; + } + + LOGI("Successfully emit signal to %s, %s, %s", + bus_name.c_str(), path_.c_str(), signal_name.c_str()); + return true; } string DBusSender::Impl::GetBusName(string appid, string dest_appid) const {