#include <Ecore.h>
#include "Eo.h"
+#include "ecore_private.h"
#include "efl_loop_model.eo.h"
typedef struct _Efl_Loop_Model_Watcher_Data Efl_Loop_Model_Watcher_Data;
return efl_future_then(obj, f);
}
+static void
+_noref_death(void *data EINA_UNUSED, const Efl_Event *event)
+{
+ efl_event_callback_del(event->object, EFL_EVENT_NOREF, _noref_death, NULL);
+ // For safety reason and in case multiple call to volatile has been made
+ // we check that there is still a parent at this point in EFL_EVENT_NOREF
+ efl_del(event->object);
+}
+
+static void
+_efl_loop_model_volatile_make(Eo *obj, void *pd EINA_UNUSED)
+{
+ // Just to make sure we do not double register this callback, we first remove
+ // any potentially previous one.
+ efl_event_callback_del(obj, EFL_EVENT_NOREF, _noref_death, NULL);
+ efl_event_callback_add(obj, EFL_EVENT_NOREF, _noref_death, NULL);
+}
+
+static void
+_efl_loop_model_efl_object_invalidate(Eo *obj, void *pd EINA_UNUSED)
+{
+ efl_event_callback_del(obj, EFL_EVENT_NOREF, _noref_death, NULL);
+
+ efl_invalidate(efl_super(obj, EFL_LOOP_MODEL_CLASS));
+}
+
#include "efl_loop_model.eo.c"
abstract @beta Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model
{
data: null;
+ methods {
+ volatile_make {
+ [[To be called when a Child model is created by @Efl.Model.children_slice_get by the one creating the child object.
+
+ This function is used to properly define the lifecycle of the new Child Model object
+ and make sure that once it has 0 ref except its parent Model, it will be destroyed.
+ This function should only be called once per child. It is useful for @Efl.Model who
+ have a lot of children and shouldn't keep more than what is used in memory.]]
+ }
+ }
implements {
+ Efl.Object.invalidate;
Efl.Model.property_ready_get;
}
}