}
vd->sttfeedback = new is::stt::SttFeedback();
- if (vd->sttfeedback) {
- vd->sttfeedback->SetVoiceData(vd);
+ vd->sttfeedback->SetVoiceData(vd);
- vd->sttmanager = new is::stt::SttManager(*(vd->sttfeedback));
- if (vd->sttmanager)
- vd->sttmanager->Prepare();
- else
- LOGW("Failed to allocate SttManager");
- } else {
- LOGW("Failed to allocate SttFeedback");
- }
+ vd->sttmanager = new is::stt::SttManager(*(vd->sttfeedback));
+ vd->sttmanager->Prepare();
} catch(std::exception &e) {
LOGD("%s", e.what());
return false;
Evas_Object *canvas = elm_object_part_content_get(voicedata->layout_main, "EFFECT_BG");
- is::ui::WInputSttMicEffect *ieffect = new is::ui::WInputSttMicEffect();
- if (ieffect && voicedata->sttmanager) {
- ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle());
- }
+ try {
+ is::ui::WInputSttMicEffect *ieffect = new is::ui::WInputSttMicEffect();
+ if (voicedata->sttmanager) {
+ ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle());
+ }
- is::ui::MicEffector *effector = new is::ui::MicEffector(canvas, voicedata->layout_main, *ieffect);
- voicedata->ieffect = ieffect;
- voicedata->effector = effector;
+ is::ui::MicEffector *effector = new is::ui::MicEffector(canvas, voicedata->layout_main, *ieffect);
+ voicedata->ieffect = ieffect;
+ voicedata->effector = effector;
- if (ieffect && voicedata->progressbar) {
- ieffect->SetProgressBar(voicedata->progressbar);
+ if (voicedata->progressbar) {
+ ieffect->SetProgressBar(voicedata->progressbar);
+ }
+ } catch (std::bad_alloc &e) {
+ LOGE("Memory allocation failed");
}
elm_access_highlight_set(voicedata->mic_button);
destroy_voice();
if (!my_voicedata) {
- my_voicedata = new VoiceData;
- if (my_voicedata == NULL) {
- LOGD("%d::::Heap Overflow, Voice Input cannot be shown!", __LINE__);
+ try {
+ my_voicedata = new VoiceData;
+ }
+ catch (std::bad_alloc &e) {
+ LOGE("%d::::Heap Overflow, Voice Input cannot be shown!", __LINE__);
return;
}
- init_voicedata(my_voicedata);
}
- if (my_voicedata) {
- init = init_voice(parent, lang, my_voicedata);
- if (init) {
- if (my_voicedata->win) {
- //ise_stt_start(my_voicedata);
- show_voice_window(my_voicedata->win, my_voicedata);
- }
- } else {
- destroy_voice();
- LOGD("%d::::Fail to create Voice window!", __LINE__);
- return;
+ init_voicedata(my_voicedata);
+
+ init = init_voice(parent, lang, my_voicedata);
+ if (init) {
+ if (my_voicedata->win) {
+ //ise_stt_start(my_voicedata);
+ show_voice_window(my_voicedata->win, my_voicedata);
}
+ } else {
+ destroy_voice();
+ LOGD("%d::::Fail to create Voice window!", __LINE__);
+ return;
}
vconf_notify_key_changed(VCONFKEY_ISE_STT_LANGUAGE, _stt_lang_changed_cb, my_voicedata);