{
if (NULL != g_conn_listener) {
dbus_connection_close(g_conn_listener);
- dbus_connection_unref(g_conn_listener);
g_conn_listener = NULL;
}
if (NULL != g_conn_sender) {
dbus_connection_close(g_conn_sender);
- dbus_connection_unref(g_conn_sender);
g_conn_sender = NULL;
}
if (NULL != g_conn_custom) {
dbus_connection_close(g_conn_custom);
- dbus_connection_unref(g_conn_custom);
g_conn_custom = NULL;
}
}
return STTD_ERROR_OPERATION_FAILED;
}
+ if (NULL == g_conn_custom) {
+ SLOG(LOG_ERROR, TAG_STTD, "[ERROR] fail to get dbus connection");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ dbus_connection_set_exit_on_disconnect(g_conn_custom, false);
+
int ret = dbus_bus_request_name(g_conn_custom, STT_SERVER_CUSTOM_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to be primary owner");
}
dbus_connection_close(g_conn_custom);
- dbus_connection_unref(g_conn_custom);
g_conn_custom = NULL;
SLOG(LOG_DEBUG, TAG_STTD, "==");
return STTD_ERROR_OPERATION_FAILED;
}
+ dbus_connection_set_exit_on_disconnect(g_conn_sender, false);
+
/* connect to the bus and check for errors */
g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
return STTD_ERROR_OPERATION_FAILED;
}
+ dbus_connection_set_exit_on_disconnect(g_conn_listener, false);
+
/* Get buxton key */
ret = __sttd_get_buxtonkey();
if (0 != ret) {