forked from enlightenment/efl
i cannot believe evas has lasted this long without this. obj ref &
unref. SVN revision: 57582
This commit is contained in:
parent
bbee4f4d04
commit
b893963ee8
|
@ -143,5 +143,6 @@
|
||||||
2011-03-08 Carsten Haitzler (The Rasterman)
|
2011-03-08 Carsten Haitzler (The Rasterman)
|
||||||
|
|
||||||
* Fix problem with different x vsync api between SGI and EXT flavor
|
* Fix problem with different x vsync api between SGI and EXT flavor
|
||||||
as they have the same base name, but different prototypes.
|
as they have the same base name, but different prototypes
|
||||||
|
* Add evas_object_ref() and evas_object_unref() to defer
|
||||||
|
deletion of objects until all references are removed
|
||||||
|
|
|
@ -898,6 +898,9 @@ typedef void (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type t
|
||||||
EAPI void evas_object_name_set (Evas_Object *obj, const char *name) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_name_set (Evas_Object *obj, const char *name) EINA_ARG_NONNULL(1);
|
||||||
EAPI const char *evas_object_name_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
EAPI const char *evas_object_name_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||||
|
|
||||||
|
EAPI void evas_object_ref (Evas_Object *obj);
|
||||||
|
EAPI void evas_object_unref (Evas_Object *obj);
|
||||||
|
|
||||||
EAPI void evas_object_del (Evas_Object *obj) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_del (Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||||
EAPI void evas_object_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
|
||||||
EAPI void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1);
|
||||||
|
|
|
@ -355,6 +355,53 @@ evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
}
|
}
|
||||||
/* routines apps will call */
|
/* routines apps will call */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments object reference count to defer deletion
|
||||||
|
*
|
||||||
|
* This increments the reference count of an object, which if greater than
|
||||||
|
* 0 will defer deletion by evas_object_del() until all references are
|
||||||
|
* released back to 0. References cannot go below 0 and unreferencing more
|
||||||
|
* times that referencing will result in the reference count being limited
|
||||||
|
* to 0. References are limited to 2^32 - 1 for an object. Referencing it more
|
||||||
|
* than this will result in it being limited to this value.
|
||||||
|
*
|
||||||
|
* @param obj The given evas object to reference
|
||||||
|
* @ingroup Evas_Object_Group_Basic
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
EAPI void
|
||||||
|
evas_object_ref(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
obj->ref++;
|
||||||
|
if (obj->ref == 0) obj->ref--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements object reference count to defer deletion
|
||||||
|
*
|
||||||
|
* This decrements the reference count of an object. If the object has had
|
||||||
|
* evas_object_del() called on it while references were more than 0, it will
|
||||||
|
* be deleted at the time this function is called as it normally would have
|
||||||
|
* been. See evas_object_ref() for more information.
|
||||||
|
*
|
||||||
|
* @param obj The given evas object to unreference
|
||||||
|
* @ingroup Evas_Object_Group_Basic
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
EAPI void
|
||||||
|
evas_object_unref(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||||
|
return;
|
||||||
|
MAGIC_CHECK_END();
|
||||||
|
if (obj->ref == 0) return;
|
||||||
|
obj->ref--;
|
||||||
|
if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given evas object and frees its memory.
|
* Deletes the given evas object and frees its memory.
|
||||||
*
|
*
|
||||||
|
@ -374,6 +421,11 @@ evas_object_del(Evas_Object *obj)
|
||||||
|
|
||||||
if (obj->delete_me) return;
|
if (obj->delete_me) return;
|
||||||
|
|
||||||
|
if (obj->ref > 0)
|
||||||
|
{
|
||||||
|
obj->del_ref = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef EVAS_FRAME_QUEUING
|
#ifdef EVAS_FRAME_QUEUING
|
||||||
evas_common_frameq_flush();
|
evas_common_frameq_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -460,6 +460,8 @@ struct _Evas_Object
|
||||||
int in_move, in_resize;
|
int in_move, in_resize;
|
||||||
} doing;
|
} doing;
|
||||||
|
|
||||||
|
unsigned int ref;
|
||||||
|
|
||||||
unsigned char delete_me;
|
unsigned char delete_me;
|
||||||
|
|
||||||
Evas_Object_Pointer_Mode pointer_mode : 1;
|
Evas_Object_Pointer_Mode pointer_mode : 1;
|
||||||
|
@ -487,6 +489,7 @@ struct _Evas_Object
|
||||||
Eina_Bool changed_move : 1;
|
Eina_Bool changed_move : 1;
|
||||||
Eina_Bool changed_move_only : 1;
|
Eina_Bool changed_move_only : 1;
|
||||||
Eina_Bool changed_nomove : 1;
|
Eina_Bool changed_nomove : 1;
|
||||||
|
Eina_Bool del_ref : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Func_Node
|
struct _Evas_Func_Node
|
||||||
|
|
Loading…
Reference in New Issue