forked from enlightenment/efl
ecore: remove data parameters of Efl.Loop_Consumer.promise_new to reduce the risk of inadvertently using the wrong data.
If you need data, use a efl_future_then as done in every case here to get the same feature. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7577
This commit is contained in:
parent
40ca3fbe58
commit
563f91eaf9
|
@ -43,11 +43,13 @@ _timeout(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNU
|
|||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
_promise_cancel(void *data, const Eina_Promise *dead EINA_UNUSED)
|
||||
static Eina_Value
|
||||
_promise_cancel(Eo *o EINA_UNUSED, void *data, Eina_Error error)
|
||||
{
|
||||
Ctx *ctx = data;
|
||||
if (ctx->timer) eina_future_cancel(ctx->timer);
|
||||
|
||||
if (error == ECANCELED && ctx->timer) eina_future_cancel(ctx->timer);
|
||||
return eina_value_error_init(error);
|
||||
}
|
||||
|
||||
static Ctx *
|
||||
|
@ -56,7 +58,7 @@ _promise_ctx_new(Efl_Loop *loop, Eina_Value *v)
|
|||
Ctx *ctx;
|
||||
ctx = calloc(1, sizeof(Ctx));
|
||||
EINA_SAFETY_ON_NULL_GOTO(ctx, err_ctx);
|
||||
ctx->p = efl_loop_promise_new(loop, ctx, _promise_cancel, NULL);
|
||||
ctx->p = efl_loop_promise_new(loop, NULL);
|
||||
EINA_SAFETY_ON_NULL_GOTO(ctx->p, err_timer);
|
||||
ctx->value = v;
|
||||
return ctx;
|
||||
|
@ -76,7 +78,7 @@ _future_get(Ctx *ctx, Efl_Loop *loop)
|
|||
EINA_SAFETY_ON_NULL_GOTO(f, err_future);
|
||||
ctx->timer = eina_future_then(efl_loop_timeout(loop, 0.1), _timeout, ctx);
|
||||
EINA_SAFETY_ON_NULL_GOTO(ctx->timer, err_timer);
|
||||
return f;
|
||||
return efl_future_then(loop, f, .error = _promise_cancel, .data = ctx);
|
||||
|
||||
err_timer:
|
||||
eina_future_cancel(f);
|
||||
|
|
|
@ -192,7 +192,6 @@ _exe_exit_eval(Eo *obj, Efl_Exe_Data *pd)
|
|||
{
|
||||
Eina_Promise *p = pd->promise;
|
||||
int exit_code = efl_task_exit_code_get(obj);
|
||||
pd->promise = NULL;
|
||||
if ((exit_code != 0) && (!(efl_task_flags_get(obj) &
|
||||
EFL_TASK_FLAGS_NO_EXIT_CODE_ERROR)))
|
||||
{
|
||||
|
@ -280,14 +279,23 @@ _cb_exe_in(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
efl_io_writer_can_write_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_run_cancel_cb(void *data, Efl_Loop_Consumer *consumer EINA_UNUSED, const Eina_Promise *dead_promise EINA_UNUSED)
|
||||
static Eina_Value
|
||||
_run_cancel_cb(Efl_Loop_Consumer *consumer, void *data EINA_UNUSED, Eina_Error error)
|
||||
{
|
||||
Eo *obj = data;
|
||||
Efl_Exe_Data *pd = efl_data_scope_get(obj, MY_CLASS);
|
||||
pd->promise = NULL;
|
||||
efl_task_end(obj);
|
||||
if (error == ECANCELED) efl_task_end(consumer);
|
||||
|
||||
return eina_value_error_init(error);
|
||||
}
|
||||
|
||||
static void
|
||||
_run_clean_cb(Efl_Loop_Consumer *consumer EINA_UNUSED,
|
||||
void *data,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Exe_Data *pd = data;
|
||||
pd->promise = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -485,8 +493,11 @@ _efl_exe_efl_task_run(Eo *obj EINA_UNUSED, Efl_Exe_Data *pd)
|
|||
EFL_LOOP_HANDLER_FLAGS_READ));
|
||||
_ecore_signal_pid_unlock();
|
||||
pd->run = EINA_TRUE;
|
||||
pd->promise = efl_loop_promise_new(obj, obj, _run_cancel_cb, NULL);
|
||||
return efl_future_then(obj, eina_future_new(pd->promise));
|
||||
pd->promise = efl_loop_promise_new(obj);
|
||||
return efl_future_then(obj, eina_future_new(pd->promise),
|
||||
.data = pd,
|
||||
.error = _run_cancel_cb,
|
||||
.free = _run_clean_cb);
|
||||
}
|
||||
// this code is in the child here, and is temporary setup until we
|
||||
// exec() the child to replace everything.
|
||||
|
|
|
@ -50,49 +50,15 @@ _efl_loop_consumer_future_rejected(const Eo *obj, Efl_Loop_Consumer_Data *pd EIN
|
|||
return eina_future_rejected(efl_loop_future_scheduler_get(obj), error);
|
||||
}
|
||||
|
||||
typedef struct _Efl_Loop_Consumer_Promise Efl_Loop_Consumer_Promise;
|
||||
struct _Efl_Loop_Consumer_Promise
|
||||
{
|
||||
EflLoopConsumerPromiseCancel func;
|
||||
Eina_Free_Cb free;
|
||||
void *data;
|
||||
Eo *obj;
|
||||
};
|
||||
|
||||
static void
|
||||
_cancel_free(void *data)
|
||||
_dummy_cancel(void *data EINA_UNUSED, const Eina_Promise *p EINA_UNUSED)
|
||||
{
|
||||
Efl_Loop_Consumer_Promise *lcp = data;
|
||||
|
||||
if (lcp->free) lcp->free(lcp->data);
|
||||
efl_unref(lcp->obj);
|
||||
free(lcp);
|
||||
}
|
||||
|
||||
static void
|
||||
_cancel_triggered(void *data, const Eina_Promise *p)
|
||||
{
|
||||
Efl_Loop_Consumer_Promise *lcp = data;
|
||||
|
||||
if (lcp->func) lcp->func(lcp->data, lcp->obj, p);
|
||||
}
|
||||
|
||||
static Eina_Promise *
|
||||
_efl_loop_consumer_promise_new(const Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED,
|
||||
void *cancel_data, EflLoopConsumerPromiseCancel cancel, Eina_Free_Cb cancel_free_cb)
|
||||
_efl_loop_consumer_promise_new(const Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Efl_Loop_Consumer_Promise *lcp;
|
||||
Eina_Promise *p;
|
||||
|
||||
lcp = calloc(1, sizeof (Efl_Loop_Consumer_Promise));
|
||||
if (!lcp) return NULL;
|
||||
|
||||
lcp->func = cancel;
|
||||
lcp->data = cancel_data;
|
||||
lcp->free = cancel_free_cb;
|
||||
lcp->obj = efl_ref(obj);
|
||||
|
||||
return eina_promise_new(efl_loop_future_scheduler_get(obj), _cancel_triggered, lcp);
|
||||
return eina_promise_new(efl_loop_future_scheduler_get(obj), _dummy_cancel, NULL);
|
||||
}
|
||||
|
||||
#include "efl_loop_consumer.eo.c"
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
function EflLoopConsumerPromiseCancel {
|
||||
[[EflLoopConsumerPromiseCancel function callback called when a promise is cancelled.]]
|
||||
params {
|
||||
@in consumer: Efl.Loop_Consumer; [[The consumer that was used to create the promise.]]
|
||||
@in dead_promise: const(ptr(Eina.Promise)); [[The promise that was just cancelled.]]
|
||||
}
|
||||
};
|
||||
|
||||
abstract Efl.Loop_Consumer (Efl.Object)
|
||||
{
|
||||
[[An Efl.Loop_Consumer is a class which requires one of the parents to provide
|
||||
|
@ -57,9 +49,6 @@ abstract Efl.Loop_Consumer (Efl.Object)
|
|||
[[Create a new promise with the scheduler coming from the loop provided by this object.
|
||||
|
||||
Note: You should not use eina_promise_data_set as this function rely on controlling the promise data.]]
|
||||
params {
|
||||
cancel: EflLoopConsumerPromiseCancel; [[Callback called when the promise is being cancelled.]]
|
||||
}
|
||||
return: ptr(Eina.Promise) @owned; [[The new promise.]]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,7 +329,6 @@ _thread_exit_eval(Eo *obj, Efl_Thread_Data *pd)
|
|||
{
|
||||
Eina_Promise *p = pd->promise;
|
||||
int exit_code = efl_task_exit_code_get(obj);
|
||||
pd->promise = NULL;
|
||||
if ((exit_code != 0) && (!(efl_task_flags_get(obj) &
|
||||
EFL_TASK_FLAGS_NO_EXIT_CODE_ERROR)))
|
||||
eina_promise_reject(p, exit_code + 1000000);
|
||||
|
@ -410,13 +409,20 @@ _cb_thread_parent_ctrl_out(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void
|
||||
_run_cancel_cb(void *data, Efl_Loop_Consumer *consumer EINA_UNUSED, const Eina_Promise *dead_promise EINA_UNUSED)
|
||||
static Eina_Value
|
||||
_run_cancel_cb(Efl_Loop_Consumer *consumer, void *data EINA_UNUSED, Eina_Error error)
|
||||
{
|
||||
Eo *obj = data;
|
||||
Efl_Thread_Data *pd = efl_data_scope_get(obj, MY_CLASS);
|
||||
if (error == ECANCELED) efl_task_end(consumer);
|
||||
|
||||
return eina_value_error_init(error);
|
||||
}
|
||||
|
||||
static void
|
||||
_run_clean_cb(Efl_Loop_Consumer *consumer EINA_UNUSED,void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Thread_Data *pd = data;
|
||||
|
||||
pd->promise = NULL;
|
||||
efl_task_end(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -776,8 +782,9 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
|
|||
}
|
||||
pd->thdat = thdat;
|
||||
pd->run = EINA_TRUE;
|
||||
pd->promise = efl_loop_promise_new(obj, obj, _run_cancel_cb, NULL);
|
||||
return efl_future_then(obj, eina_future_new(pd->promise));
|
||||
pd->promise = efl_loop_promise_new(obj);
|
||||
return efl_future_then(obj, eina_future_new(pd->promise),
|
||||
.data = pd, .error = _run_cancel_cb, .free = _run_clean_cb);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -726,13 +726,11 @@ static void
|
|||
_efl_net_control_access_point_connect_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
||||
{
|
||||
Eina_Promise *promise = data;
|
||||
Efl_Object *o = eina_promise_data_get(promise);
|
||||
Efl_Net_Control_Access_Point_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
||||
Efl_Net_Control_Access_Point_Data *pd = eldbus_pending_data_get(pending, ".object");
|
||||
const char *err_name, *err_msg;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||
|
||||
pd->pending = eina_list_remove(pd->pending, pending);
|
||||
if (eldbus_message_error_get(msg, &err_name, &err_msg))
|
||||
{
|
||||
Eina_Error err = EINVAL;
|
||||
|
@ -741,7 +739,7 @@ _efl_net_control_access_point_connect_cb(void *data, const Eldbus_Message *msg,
|
|||
err = EINPROGRESS;
|
||||
else if (strcmp(err_name, "net.connman.Error.AlreadyConnected") == 0)
|
||||
err = EALREADY;
|
||||
WRN("Could not Connect %p: %s=%s", o, err_name, err_msg);
|
||||
WRN("Could not Connect: %s=%s", err_name, err_msg);
|
||||
|
||||
eina_promise_reject(promise, err);
|
||||
return;
|
||||
|
@ -750,20 +748,29 @@ _efl_net_control_access_point_connect_cb(void *data, const Eldbus_Message *msg,
|
|||
eina_promise_resolve(promise, EINA_VALUE_EMPTY);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_net_control_access_point_connect_promise_del(void *data, Efl_Loop_Consumer *consumer EINA_UNUSED, const Eina_Promise *dead_ptr)
|
||||
static Eina_Value
|
||||
_efl_net_control_access_point_connect_promise_del(Efl_Loop_Consumer *consumer EINA_UNUSED, void *data, Eina_Error error)
|
||||
{
|
||||
Eldbus_Pending *p = data;
|
||||
Efl_Net_Control_Access_Point_Data *pd;
|
||||
if (error == ECANCELED)
|
||||
{
|
||||
Eldbus_Pending *p = data;
|
||||
|
||||
p = eina_promise_data_get(dead_ptr);
|
||||
if (!p) return; /* already gone, nothing to do */
|
||||
DBG("cancel pending connect %p", p);
|
||||
eldbus_pending_cancel(p);
|
||||
}
|
||||
|
||||
return eina_value_error_init(error);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_net_control_access_point_connect_promise_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Net_Control_Access_Point_Data *pd;
|
||||
Eldbus_Pending *p = data;
|
||||
|
||||
pd = eldbus_pending_data_get(p, ".object");
|
||||
|
||||
pd->pending = eina_list_remove(pd->pending, p);
|
||||
DBG("cancel pending connect %p", p);
|
||||
eldbus_pending_cancel(p);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Future *
|
||||
|
@ -773,7 +780,7 @@ _efl_net_control_access_point_connect(Eo *o, Efl_Net_Control_Access_Point_Data *
|
|||
Eina_Promise *promise;
|
||||
Eina_Future *f = NULL;
|
||||
|
||||
promise = efl_loop_promise_new(o, o, _efl_net_control_access_point_connect_promise_del, NULL);
|
||||
promise = efl_loop_promise_new(o);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(promise, NULL);
|
||||
|
||||
f = eina_future_new(promise);
|
||||
|
@ -785,7 +792,10 @@ _efl_net_control_access_point_connect(Eo *o, Efl_Net_Control_Access_Point_Data *
|
|||
pd->pending = eina_list_append(pd->pending, p);
|
||||
eldbus_pending_data_set(p, ".object", pd);
|
||||
|
||||
return efl_future_then(o, f);
|
||||
return efl_future_then(o, f,
|
||||
.data = p,
|
||||
.error = _efl_net_control_access_point_connect_promise_del,
|
||||
.free = _efl_net_control_access_point_connect_promise_clean);
|
||||
|
||||
error_dbus:
|
||||
eina_promise_reject(promise, ENOSYS);
|
||||
|
|
|
@ -398,7 +398,7 @@ _efl_net_control_technology_scan(Eo *o, Efl_Net_Control_Technology_Data *pd)
|
|||
Eina_Promise *promise;
|
||||
Eina_Future *f = NULL;
|
||||
|
||||
promise = efl_loop_promise_new(o, NULL, NULL, NULL);
|
||||
promise = efl_loop_promise_new(o);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(promise, NULL);
|
||||
|
||||
f = eina_future_new(promise);
|
||||
|
|
|
@ -119,7 +119,7 @@ _efl_io_manager_direct_ls(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -161,7 +161,7 @@ _efl_io_manager_stat_ls(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -202,7 +202,7 @@ _efl_io_manager_ls(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -253,7 +253,7 @@ _efl_io_manager_stat(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -281,7 +281,7 @@ _efl_io_manager_xattr_ls(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -331,7 +331,7 @@ _efl_io_manager_xattr_set(Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -360,7 +360,7 @@ _efl_io_manager_xattr_get(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -397,7 +397,7 @@ _efl_io_manager_open(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
@ -422,7 +422,7 @@ _efl_io_manager_close(const Eo *obj,
|
|||
Eina_Future *future;
|
||||
Eio_File *h;
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
future = eina_future_new(p);
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ _delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev)
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_cancel_request(Efl_Loop *loop EINA_UNUSED, void *data, Eina_Error error)
|
||||
_cancel_request(Eo *model EINA_UNUSED, void *data, Eina_Error error)
|
||||
{
|
||||
delayed_queue = eina_list_remove_list(delayed_queue, data);
|
||||
|
||||
|
@ -415,23 +415,23 @@ _cancel_request(Efl_Loop *loop EINA_UNUSED, void *data, Eina_Error error)
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_build_delay(Efl_Loop *loop)
|
||||
_build_delay(Eio_Model *model)
|
||||
{
|
||||
Eina_Promise *p;
|
||||
|
||||
p = eina_promise_new(efl_loop_future_scheduler_get(loop), NULL, NULL);
|
||||
p = efl_loop_promise_new(model);
|
||||
|
||||
if (!delayed_queue)
|
||||
{
|
||||
// Remove callback, just in case it is still there.
|
||||
efl_event_callback_del(loop, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
|
||||
efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
|
||||
efl_event_callback_del(efl_loop_get(model), EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
|
||||
efl_event_callback_add(efl_loop_get(model), EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
|
||||
// FIXME: It would be nice to be able to build a future directly to be triggered on one event
|
||||
}
|
||||
|
||||
delayed_queue = eina_list_append(delayed_queue, p);
|
||||
|
||||
return efl_future_then(loop, eina_future_new(p),
|
||||
return efl_future_then(model, eina_future_new(p),
|
||||
.error = _cancel_request,
|
||||
.data = eina_list_last(delayed_queue));
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ _eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_futu
|
|||
// Make sure that we are not over consuming time in the main loop
|
||||
if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004)
|
||||
{
|
||||
Eina_Future *f = eina_future_then(_build_delay(pd->loop),
|
||||
Eina_Future *f = eina_future_then(_build_delay(model),
|
||||
_eio_build_mime_now, model, NULL);
|
||||
return eina_future_as_value(efl_future_then(model, f));
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ _eio_build_mime(const Efl_Object *model, Eio_Model_Data *pd)
|
|||
if (pd->mime_type) return ;
|
||||
if (pd->request.mime) return ;
|
||||
|
||||
efl_wref_add(efl_provider_find(model, EFL_LOOP_CLASS), &pd->loop);
|
||||
efl_wref_add(efl_loop_get(model), &pd->loop);
|
||||
|
||||
f = efl_loop_job(pd->loop);
|
||||
f = eina_future_then(f, _eio_build_mime_now, model, NULL);
|
||||
|
@ -685,7 +685,7 @@ _eio_model_efl_model_property_set(Eo *obj,
|
|||
|
||||
if (finalized)
|
||||
{
|
||||
Eina_Promise *p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
Eina_Promise *p = efl_loop_promise_new(obj);
|
||||
f = eina_future_new(p);
|
||||
|
||||
pd->request.move = eio_file_move(pd->path, path,
|
||||
|
|
|
@ -70,7 +70,7 @@ _eldbus_model_connection_efl_model_children_slice_get(Eo *obj,
|
|||
return efl_loop_future_resolved(obj, v);
|
||||
}
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, _eldbus_eina_promise_cancel, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
|
||||
slice = calloc(1, sizeof (Eldbus_Children_Slice_Promise));
|
||||
slice->p = p;
|
||||
|
|
|
@ -127,7 +127,7 @@ _eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
|
|||
return efl_loop_future_resolved(obj, v);
|
||||
}
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, _eldbus_eina_promise_cancel, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
|
||||
slice = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise));
|
||||
slice->p = p;
|
||||
|
|
|
@ -39,13 +39,6 @@ struct _Eldbus_Model_Data
|
|||
/* logging support */
|
||||
extern int eldbus_model_log_dom;
|
||||
|
||||
static inline void
|
||||
_eldbus_eina_promise_cancel(void *data EINA_UNUSED,
|
||||
Efl_Loop_Consumer *consumer EINA_UNUSED,
|
||||
const Eina_Promise *dead_ptr EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
#define ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(exp, promise, err, v) \
|
||||
do \
|
||||
{ \
|
||||
|
|
|
@ -229,9 +229,9 @@ eldbus_model_proxy_property_check(Eldbus_Model_Proxy_Data *pd,
|
|||
}
|
||||
|
||||
static void
|
||||
_eldbus_model_proxy_cancel_cb(void *data,
|
||||
Efl_Loop_Consumer *consumer EINA_UNUSED,
|
||||
const Eina_Promise *dead_promise EINA_UNUSED)
|
||||
_eldbus_model_proxy_cancel_cb(Efl_Loop_Consumer *consumer EINA_UNUSED,
|
||||
void *data,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Eldbus_Model_Proxy_Property_Set_Data *sd = data;
|
||||
|
||||
|
@ -294,7 +294,7 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
|
|||
if (!data) goto on_error;
|
||||
|
||||
data->pd = pd;
|
||||
data->promise = efl_loop_promise_new(obj, data, _eldbus_model_proxy_cancel_cb, NULL);
|
||||
data->promise = efl_loop_promise_new(obj);
|
||||
data->property = eina_stringshare_add(property);
|
||||
if (!(data->value = eina_value_dup(value))) goto on_error;
|
||||
|
||||
|
@ -310,7 +310,8 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
if (pending) pd->pendings = eina_list_append(pd->pendings, pending);
|
||||
return efl_future_then(obj, eina_future_new(data->promise));
|
||||
return efl_future_then(obj, eina_future_new(data->promise),
|
||||
.data = data, .free = _eldbus_model_proxy_cancel_cb);
|
||||
|
||||
on_error:
|
||||
return efl_loop_future_rejected(obj, err);
|
||||
|
|
|
@ -242,7 +242,7 @@ _update_sel_lost_list(Efl_Object *obj, Efl_Ui_Selection_Type type,
|
|||
sel_lost->seat_sel = seat_sel;
|
||||
seat_sel->sel_lost_list = eina_list_append(seat_sel->sel_lost_list, sel_lost);
|
||||
|
||||
p = efl_loop_promise_new(obj, NULL, NULL, NULL);
|
||||
p = efl_loop_promise_new(obj);
|
||||
if (!p) return NULL;
|
||||
sel_lost->promise = p;
|
||||
|
||||
|
|
Loading…
Reference in New Issue