summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_model.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-04 16:01:40 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-16 14:33:16 -0800
commit04090f3e7acef5ca47b7b44033dbf3312ae8b6d1 (patch)
tree9cf300b9ceec2901a1938e7e9c0f2a32bc0a2c82 /src/lib/eio/eio_model.c
parent54729224672db79ff2ec09307ac862ddf494f131 (diff)
eio: remove use of eina_promise_data_set.
eina_promise_data_set is a misleading API and result in conflicted use by multiple independent piece of code leading to bug and crash. It is also not necessary and we can avoid using it completely. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7572
Diffstat (limited to 'src/lib/eio/eio_model.c')
-rw-r--r--src/lib/eio/eio_model.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c
index c6e03e6..d080830 100644
--- a/src/lib/eio/eio_model.c
+++ b/src/lib/eio/eio_model.c
@@ -406,10 +406,12 @@ _delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev)
406 efl_event_callback_del(ev->object, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL); 406 efl_event_callback_del(ev->object, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
407} 407}
408 408
409static void 409static Eina_Value
410_cancel_request(void *data, const Eina_Promise *dead_ptr EINA_UNUSED) 410_cancel_request(Efl_Loop *loop EINA_UNUSED, void *data, Eina_Error error)
411{ 411{
412 delayed_queue = eina_list_remove_list(delayed_queue, data); 412 delayed_queue = eina_list_remove_list(delayed_queue, data);
413
414 return eina_value_error_init(error);
413} 415}
414 416
415static Eina_Future * 417static Eina_Future *
@@ -417,7 +419,7 @@ _build_delay(Efl_Loop *loop)
417{ 419{
418 Eina_Promise *p; 420 Eina_Promise *p;
419 421
420 p = eina_promise_new(efl_loop_future_scheduler_get(loop), _cancel_request, NULL); 422 p = eina_promise_new(efl_loop_future_scheduler_get(loop), NULL, NULL);
421 423
422 if (!delayed_queue) 424 if (!delayed_queue)
423 { 425 {
@@ -428,9 +430,10 @@ _build_delay(Efl_Loop *loop)
428 } 430 }
429 431
430 delayed_queue = eina_list_append(delayed_queue, p); 432 delayed_queue = eina_list_append(delayed_queue, p);
431 eina_promise_data_set(p, eina_list_last(delayed_queue));
432 433
433 return eina_future_new(p); 434 return efl_future_then(loop, eina_future_new(p),
435 .error = _cancel_request,
436 .data = eina_list_last(delayed_queue));
434} 437}
435 438
436static void 439static void
@@ -682,7 +685,7 @@ _eio_model_efl_model_property_set(Eo *obj,
682 685
683 if (finalized) 686 if (finalized)
684 { 687 {
685 Eina_Promise *p = eina_promise_new(efl_loop_future_scheduler_get(obj), _efl_io_manager_future_cancel, NULL); 688 Eina_Promise *p = efl_loop_promise_new(obj, NULL, NULL, NULL);
686 f = eina_future_new(p); 689 f = eina_future_new(p);
687 690
688 pd->request.move = eio_file_move(pd->path, path, 691 pd->request.move = eio_file_move(pd->path, path,
@@ -690,17 +693,17 @@ _eio_model_efl_model_property_set(Eo *obj,
690 _eio_move_done_cb, _eio_file_error_cb, p); 693 _eio_move_done_cb, _eio_file_error_cb, p);
691 694
692 ecore_thread_local_data_add(pd->request.move->thread, ".pd", pd, NULL, EINA_TRUE); 695 ecore_thread_local_data_add(pd->request.move->thread, ".pd", pd, NULL, EINA_TRUE);
693 eina_promise_data_set(p, pd->request.move); 696
697 f = _efl_io_manager_future(obj, f, pd->request.move);
694 698
695 // FIXME: turn on monitor in the finalize stage or after move 699 // FIXME: turn on monitor in the finalize stage or after move
696 } 700 }
697 else 701 else
698 { 702 {
699 f = efl_loop_future_resolved(obj, 703 f = efl_loop_future_resolved(obj, eina_value_string_init(pd->path));
700 eina_value_string_init(pd->path));
701 } 704 }
702 705
703 return efl_future_then(obj, f); 706 return f;
704 707
705 on_error: 708 on_error:
706 return efl_loop_future_rejected(obj, err); 709 return efl_loop_future_rejected(obj, err);