return;
}
+ // continue function if cancel == 1 or signal_handling_timer == 0
+ if (!cancel && signal_handling_timer)
+ return;
+
+ // this function will free text_to_read and desc_to_read if fails
+ // (looks like very bad desing to me)
Signal_Handling_Timer_Data *shtd = create_shtd(event->source, text_to_read, desc_to_read);
- if (shtd) {
- DEBUG("Stop current reading and add timer");
- shtd->discardable = EINA_TRUE;
- if (cancel) {
- shtd->want_discard_previous_reading = EINA_TRUE;
- tts_purge(EINA_TRUE);
- DEBUG("Reading cancelled, tts purged");
- if (signal_handling_timer) {
- DEBUG("Reading cancelled, timer deleted");
- Signal_Handling_Timer_Data *prev_shtd = ecore_timer_del(signal_handling_timer);
- signal_handling_timer = NULL;
- if (prev_shtd && !prev_shtd->inside_cb)
- free_shtd(prev_shtd);
- }
- } else {
- shtd->want_discard_previous_reading = EINA_FALSE;
- }
+ if (!shtd) {
+ DEBUG("Error - create_shtd failed");
+ return;
+ }
- if (cancel || !signal_handling_timer) {
- signal_handling_timer = ecore_timer_add(SIGNAL_HANDLING_TIMEOUT, _signal_handling_timer_cb, shtd);
- if (signal_handling_timer)
- DEBUG("END - Timer added (text:%s desc:%s source:%p)", text_to_read, desc_to_read ? desc_to_read : "null", event->source);
- else
- DEBUG("Error - Create timer failed");
- } else {
- DEBUG("END - Reading skipped, cancel=%d", cancel);
+ DEBUG("Stop current reading and add timer");
+ shtd->discardable = EINA_TRUE;
+ if (cancel) {
+ shtd->want_discard_previous_reading = EINA_TRUE;
+ tts_purge(EINA_TRUE);
+ DEBUG("Reading cancelled, tts purged");
+ if (signal_handling_timer) {
+ DEBUG("Reading cancelled, timer deleted");
+ Signal_Handling_Timer_Data *prev_shtd = ecore_timer_del(signal_handling_timer);
+ signal_handling_timer = NULL;
+ if (prev_shtd && !prev_shtd->inside_cb)
+ free_shtd(prev_shtd);
}
-
} else {
- DEBUG("Error - create_shtd failed");
+ shtd->want_discard_previous_reading = EINA_FALSE;
}
+
+ // at this point signal_handling_timer == NULL
+ signal_handling_timer = ecore_timer_add(SIGNAL_HANDLING_TIMEOUT, _signal_handling_timer_cb, shtd);
+ if (!signal_handling_timer) {
+ DEBUG("Error - ecore_timer_add failed");
+ free_shtd(shtd);
+ return;
+ }
+
+ DEBUG("END - Timer added (text:%s desc:%s source:%p)", text_to_read, desc_to_read ? desc_to_read : "null", event->source);
}
/**