diff options
author | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-09 10:13:49 -0200 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-09 13:47:04 -0200 |
commit | 36612adeff7f347ebf76281a3509d8559f8d247b (patch) | |
tree | 2b7dc3636b1f718e902ccb5907dd8860e27e58f8 | |
parent | 47f9d06d0beff279355b312d417c2b04f3212b82 (diff) | |
download | efl-36612adeff7f347ebf76281a3509d8559f8d247b.tar.gz |
efl_io_queue: callbacks may close the queue.
For example, _efl_io_queue_update_cans() triggers "can_read,changed"
and from there users may close the queue, in such case we shouldn't
set can_write.
-rw-r--r-- | src/lib/efl/interfaces/efl_io_queue.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/efl/interfaces/efl_io_queue.c b/src/lib/efl/interfaces/efl_io_queue.c index 277ab36efe..503adc6e69 100644 --- a/src/lib/efl/interfaces/efl_io_queue.c +++ b/src/lib/efl/interfaces/efl_io_queue.c @@ -142,6 +142,7 @@ _efl_io_queue_update_cans(Eo *o, Efl_Io_Queue_Data *pd) size_t limit; efl_io_reader_can_read_set(o, used > 0); + if (pd->closed) return; /* may be closed from "can_read,changed" */ limit = efl_io_queue_limit_get(o); if (pd->pending_eos) @@ -181,6 +182,7 @@ _efl_io_queue_limit_set(Eo *o, Efl_Io_Queue_Data *pd, size_t limit) _efl_io_queue_adjust_and_realloc_if_needed(o, pd); efl_event_callback_call(o, EFL_IO_QUEUE_EVENT_SLICE_CHANGED, NULL); + if (pd->closed) return; end: _efl_io_queue_update_cans(o, pd); @@ -217,6 +219,7 @@ _efl_io_queue_clear(Eo *o, Efl_Io_Queue_Data *pd) pd->position_write = 0; efl_io_reader_can_read_set(o, EINA_FALSE); efl_event_callback_call(o, EFL_IO_QUEUE_EVENT_SLICE_CHANGED, NULL); + if (pd->closed) return; if (pd->pending_eos) efl_io_reader_eos_set(o, EINA_TRUE); } @@ -286,6 +289,7 @@ _efl_io_queue_efl_io_reader_read(Eo *o, Efl_Io_Queue_Data *pd, Eina_Rw_Slice *rw efl_io_reader_can_read_set(o, pd->position_read < pd->position_write); efl_event_callback_call(o, EFL_IO_QUEUE_EVENT_SLICE_CHANGED, NULL); + if (pd->closed) return 0; if ((pd->pending_eos) && (efl_io_queue_usage_get(o) == 0)) efl_io_reader_eos_set(o, EINA_TRUE); @@ -316,6 +320,7 @@ _efl_io_queue_discard(Eo *o, Efl_Io_Queue_Data *pd, size_t amount) efl_io_reader_can_read_set(o, pd->position_read < pd->position_write); efl_event_callback_call(o, EFL_IO_QUEUE_EVENT_SLICE_CHANGED, NULL); + if (pd->closed) return; if ((pd->pending_eos) && (efl_io_queue_usage_get(o) == 0)) efl_io_reader_eos_set(o, EINA_TRUE); @@ -409,6 +414,7 @@ _efl_io_queue_efl_io_writer_write(Eo *o, Efl_Io_Queue_Data *pd, Eina_Slice *slic _efl_io_queue_adjust_and_realloc_if_needed(o, pd); efl_event_callback_call(o, EFL_IO_QUEUE_EVENT_SLICE_CHANGED, NULL); + if (pd->closed) return 0; _efl_io_queue_update_cans(o, pd); return 0; |