is_first_client = true;
}
- if (0 != tts_client_new(tts)) {
+ tts_h new_tts = NULL;
+ if (0 != tts_client_new(&new_tts)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create client!!!!!");
return TTS_ERROR_OUT_OF_MEMORY;
}
- tts_client_s* client = tts_client_get(*tts);
+ tts_client_s* client = tts_client_get(new_tts);
if (NULL == client) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get client");
+ tts_client_destroy(new_tts);
return TTS_ERROR_OPERATION_FAILED;
}
}
if (0 != tts_ipc_open_connection(uid)) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open dbus connection");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open ipc connection");
+ tts_client_destroy(new_tts);
return TTS_ERROR_OPERATION_FAILED;
}
int ret = tts_config_mgr_initialize(uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to init config manager : %d", ret);
- tts_client_destroy(*tts);
+ tts_client_destroy(new_tts);
return __tts_convert_config_error_code(ret);
}
- ret = tts_config_mgr_set_callback(uid, __tts_config_engine_changed_cb, __tts_config_voice_changed_cb, NULL, NULL, NULL, tts);
+ ret = tts_config_mgr_set_callback(uid, __tts_config_engine_changed_cb, __tts_config_voice_changed_cb, NULL, NULL, NULL, new_tts);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set config changed : %d", ret);
tts_config_mgr_finalize(uid);
- tts_client_destroy(*tts);
+ tts_client_destroy(new_tts);
return __tts_convert_config_error_code(ret);
}
if (0 != tts_core_initialize()) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize core");
tts_config_mgr_finalize(uid);
- tts_client_destroy(*tts);
+ tts_client_destroy(new_tts);
return TTS_ERROR_OPERATION_FAILED;
}
}
+ *tts = new_tts;
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return TTS_ERROR_NONE;
}