summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-04 16:04:49 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-16 14:33:18 -0800
commitd67a7df9caadca59536e487f7d4fc6df1b33d8b7 (patch)
tree3562812239d903f4978b6afd1b1654771ed94c6a /src/lib/eina
parent04090f3e7acef5ca47b7b44033dbf3312ae8b6d1 (diff)
Revert "fix crashes created by "make efl_loop_promise_new a function""
This serie of patch didn't address the core problem in the design of the ownership of eina_promise_data_{set/get} usage. It is also redundant with other infrastructure in eina_promise and so not necessary completely. This reverts commit de2ec0559b01dba7919503955cc47c1c5fcd0f97. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7573
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_promise.c36
-rw-r--r--src/lib/eina/eina_promise.h42
2 files changed, 2 insertions, 76 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index aa5ced8ab2..c239ba6261 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -103,8 +103,6 @@ struct _Eina_Promise {
103 Eina_Future *future; 103 Eina_Future *future;
104 Eina_Future_Scheduler *scheduler; 104 Eina_Future_Scheduler *scheduler;
105 Eina_Promise_Cancel_Cb cancel; 105 Eina_Promise_Cancel_Cb cancel;
106 Eina_Promise_Data_Set_Cb data_set_cb;
107 Eina_Promise_Data_Free_Cb_Set_Cb data_free_cb_set_cb;
108 Eina_Free_Cb free_cb; 106 Eina_Free_Cb free_cb;
109 const void *data; 107 const void *data;
110}; 108};
@@ -1118,14 +1116,7 @@ eina_promise_data_set(Eina_Promise *p,
1118 void *data) 1116 void *data)
1119{ 1117{
1120 EINA_SAFETY_ON_NULL_RETURN(p); 1118 EINA_SAFETY_ON_NULL_RETURN(p);
1121 if (p->data_set_cb) 1119 p->data = data;
1122 {
1123 Eina_Promise_Data_Set_Cb cb = p->data_set_cb;
1124 p->data_set_cb = NULL;
1125 cb(p, data);
1126 p->data_set_cb = cb;
1127 }
1128 else p->data = data;
1129} 1120}
1130 1121
1131EAPI void 1122EAPI void
@@ -1133,30 +1124,7 @@ eina_promise_data_free_cb_set(Eina_Promise *p,
1133 Eina_Free_Cb free_cb) 1124 Eina_Free_Cb free_cb)
1134{ 1125{
1135 EINA_SAFETY_ON_NULL_RETURN(p); 1126 EINA_SAFETY_ON_NULL_RETURN(p);
1136 if (p->data_free_cb_set_cb) 1127 p->free_cb = free_cb;
1137 {
1138 Eina_Promise_Data_Free_Cb_Set_Cb cb = p->data_free_cb_set_cb;
1139 p->data_free_cb_set_cb = NULL;
1140 cb(p, free_cb);
1141 p->data_free_cb_set_cb = cb;
1142 }
1143 else p->free_cb = free_cb;
1144}
1145
1146EAPI void
1147eina_promise_data_set_cb_set(Eina_Promise *p,
1148 Eina_Promise_Data_Set_Cb data_set_cb)
1149{
1150 EINA_SAFETY_ON_NULL_RETURN(p);
1151 p->data_set_cb = data_set_cb;
1152}
1153
1154EAPI void
1155eina_promise_data_free_cb_set_cb_set(Eina_Promise *p,
1156 Eina_Promise_Data_Free_Cb_Set_Cb data_free_cb_set_cb)
1157{
1158 EINA_SAFETY_ON_NULL_RETURN(p);
1159 p->data_free_cb_set_cb = data_free_cb_set_cb;
1160} 1128}
1161 1129
1162static Eina_Value 1130static Eina_Value
diff --git a/src/lib/eina/eina_promise.h b/src/lib/eina/eina_promise.h
index 060d8dccf8..1896260dba 100644
--- a/src/lib/eina/eina_promise.h
+++ b/src/lib/eina/eina_promise.h
@@ -187,26 +187,6 @@ struct _Eina_Future_Scheduler {
187 */ 187 */
188typedef void (*Eina_Promise_Cancel_Cb) (void *data, const Eina_Promise *dead_promise); 188typedef void (*Eina_Promise_Cancel_Cb) (void *data, const Eina_Promise *dead_promise);
189 189
190/*
191 * @typedef Eina_Promise_Data_Set_Cb Eina_Promise_Data_Set_Cb.
192 * @ingroup eina_promise
193 *
194 * A callback used to intercept eina_promise_data_set().
195 *
196 * Used internally by EFL - please do not use.
197 */
198typedef void (*Eina_Promise_Data_Set_Cb) (Eina_Promise *p, void *data);
199
200/*
201 * @typedef Eina_Promise_Data_Free_Cb_Set_Cb Eina_Promise_Data_Free_Cb_Set_Cb.
202 * @ingroup eina_promise
203 *
204 * A callback used to intercept eina_promise_data_set_cb_set().
205 *
206 * Used internally by EFL - please do not use.
207 */
208typedef void (*Eina_Promise_Data_Free_Cb_Set_Cb) (Eina_Promise *p, Eina_Free_Cb free_cb);
209
210/** 190/**
211 * @typedef Eina_Future_Success_Cb Eina_Future_Success_Cb. 191 * @typedef Eina_Future_Success_Cb Eina_Future_Success_Cb.
212 * @ingroup eina_future 192 * @ingroup eina_future
@@ -657,28 +637,6 @@ EAPI void eina_promise_data_set(Eina_Promise *p, void *data) EINA_ARG_NONNULL(1)
657EAPI void eina_promise_data_free_cb_set(Eina_Promise *p, Eina_Free_Cb free_cb); 637EAPI void eina_promise_data_free_cb_set(Eina_Promise *p, Eina_Free_Cb free_cb);
658 638
659/** 639/**
660 * Sets a data set intercept function that can alter the behavior of
661 * eina_promise_data_set(). Please do not use this as it is only used
662 * internally inside EFL and may be used to slightly alter a promise
663 * behavior and if used on these promises may remove EFL's override
664 *
665 * @param[in] p The promise to set the data set callback on
666 * @param[in] data_set_cb The callabck to intercept the data set
667 */
668EAPI void eina_promise_data_set_cb_set(Eina_Promise *p, Eina_Promise_Data_Set_Cb data_set_cb);
669
670/**
671 * Sets a data free cb set intercept function that can alter the behavior of
672 * eina_promise_data_free_cb_set(). Please do not use this as it is only used
673 * internally inside EFL and may be used to slightly alter a promise
674 * behavior and if used on these promises may remove EFL's override
675 *
676 * @param[in] p The promise to set the data set callback on
677 * @param[in] data_free_cb_set_cb The callabck to intercept the data free cb set
678 */
679EAPI void eina_promise_data_free_cb_set_cb_set(Eina_Promise *p, Eina_Promise_Data_Free_Cb_Set_Cb data_free_cb_set_cb);
680
681/**
682 * Resolves a promise. 640 * Resolves a promise.
683 * 641 *
684 * This function schedules a resolve event in a 642 * This function schedules a resolve event in a