This is another cleanup in perparation for the Eo stable release.
This is no longer needed thanks to the proper error reporting with
eo_constructor()'s new return value.
The finalizer change cleans it up a bit so it catches more cases/issues.
This also means that the finalizer cleans up the object in all cases,
and not only some.
@feature.
{
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE);
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return EINA_FALSE;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_animator_eo_base_finalize(Eo *obj, Ecore_Animator_Data *pd)
+{
+ if (!pd->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
EAPI void
ecore_animator_frametime_set(double frametime)
{
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
Eo.Base.event_freeze;
Eo.Base.event_thaw;
}
{
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE);
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return EINA_FALSE;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_idle_enterer_eo_base_finalize(Eo *obj, Ecore_Idle_Enterer_Data *idle_enterer)
+{
+ if (!idle_enterer->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
void
_ecore_idle_enterer_shutdown(void)
{
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
}
constructors {
.before_constructor;
_ecore_lock();
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN;
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return;
}
return idle_exiter->data;
}
+EOLIAN static Eo *
+_ecore_idle_exiter_eo_base_finalize(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter)
+{
+ if (!idle_exiter)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
EOLIAN static void
_ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter)
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
}
constructors {
.constructor;
{
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN;
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_idler_eo_base_finalize(Eo *obj, Ecore_Idler_Data *idler)
+{
+ if (!idler->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
void
_ecore_idler_shutdown(void)
{
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
}
constructors {
.constructor;
{
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN;
}
eo_manual_free_set(obj, EINA_TRUE);
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return;
}
job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, obj);
if (!job->event)
{
- eo_error_set(obj);
ERR("no event was assigned to object '%p' of class '%s'", obj, MY_CLASS_NAME);
return;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_job_eo_base_finalize(Eo *obj, Ecore_Job_Data *pd)
+{
+ if (!pd->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
static Eina_Bool
_ecore_job_event_handler(void *data EINA_UNUSED,
int type EINA_UNUSED,
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
}
constructors {
.constructor;
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN;
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_poller_eo_base_finalize(Eo *obj, Ecore_Poller_Data *pd)
+{
+ if (!pd->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
void
_ecore_poller_shutdown(void)
{
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
}
constructors {
.constructor;
if (EINA_UNLIKELY(!eina_main_loop_is()))
{
- eo_error_set(obj);
EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE);
}
if (!func)
{
- eo_error_set(obj);
ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME);
return EINA_FALSE;
}
eo_do_super(obj, MY_CLASS, eo_destructor());
}
+EOLIAN static Eo *
+_ecore_timer_eo_base_finalize(Eo *obj, Ecore_Timer_Data *pd)
+{
+ if (!pd->func)
+ {
+ return NULL;
+ }
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
void
_ecore_timer_shutdown(void)
{
}
implements {
Eo.Base.destructor;
+ Eo.Base.finalize;
Eo.Base.event_freeze;
/* XXX: can't document overriden methods
* Pauses a running timer.
{
url_obj = eo_do_super_ret(url_obj, MY_CLASS, url_obj, eo_constructor());
- if (!_init_count) eo_error_set(url_obj);
- if (!_c_init())
+ if (!_init_count || !_c_init())
{
- eo_error_set(url_obj);
+ ERR("Failed");
return NULL;
}
url_con->curl_easy = _c->curl_easy_init();
if (!url_con->curl_easy)
{
- eo_error_set(url_obj);
+ ERR("Failed");
return NULL;
}
*/
EAPI const Eo_Class *eo_class_get(const Eo *obj);
-/**
- * @def eo_error_set
- * @brief Notify eo that there was an error when constructing, destructing or calling a function of the object.
- * @param obj the object to work on.
- *
- * @see eo_error_get()
- */
-#define eo_error_set(obj) eo_error_set_internal(obj, __FILE__, __LINE__)
-
-/* @cond 0 */
-EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line);
-/* @endcond */
-
#define _eo_add_common(klass, parent, is_ref, ...) \
( \
_eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \
return eo_id;
}
-Eo *
+static Eo *
_eo_add_internal_end(Eo *eo_id)
{
Eo_Stack_Frame *fptr;
fptr = stack->frame_ptr;
- if ((fptr == NULL) || (fptr->eo_id != eo_id))
+ if ((fptr == NULL) || (eo_id && (fptr->eo_id != eo_id)))
{
ERR("Something very wrong happend to the call stack.");
return NULL;
return NULL;
}
- if (!fptr->o.obj->condtor_done || fptr->o.obj->do_error)
{
const _Eo_Class *klass = (fptr->cur_klass) ?
fptr->cur_klass : fptr->o.obj->klass;
- ERR("Object of class '%s' - Not all of the object constructors have been executed.",
- klass->desc->name);
- /* Unref twice, once for the ref in _eo_add_internal_start, and once for the basic object ref. */
- _eo_unref(fptr->o.obj);
- _eo_unref(fptr->o.obj);
- return NULL;
+
+ if (!fptr->o.obj->condtor_done)
+ {
+ ERR("Object of class '%s' - Not all of the object constructors have been executed.",
+ klass->desc->name);
+ goto cleanup;
+ }
+
+ if (!eo_id)
+ {
+ ERR("Object of class '%s' - Finalizing the object failed.",
+ klass->desc->name);
+ goto cleanup;
+ }
}
fptr->o.obj->finalized = EINA_TRUE;
_eo_unref(fptr->o.obj);
return (Eo *)eo_id;
+
+cleanup:
+ /* Unref twice, once for the ref in _eo_add_internal_start, and once for the basic object ref. */
+ _eo_unref(fptr->o.obj);
+ _eo_unref(fptr->o.obj);
+ return NULL;
}
EAPI Eo *
_eo_add_end(void)
{
Eo *ret = eo_finalize();
+ ret = _eo_add_internal_end(ret);
_eo_do_end();
return ret;
}
return obj->refcount;
}
-EAPI void
-eo_error_set_internal(const Eo *obj_id, const char *file, int line)
-{
- EO_OBJ_POINTER_RETURN(obj_id, obj);
-
- ERR("Error with obj '%p' at %s:%d.", obj, file, line);
-
- obj->do_error = EINA_TRUE;
-}
-
void
_eo_condtor_done(Eo *obj_id)
{
EOLIAN static Eo *
_eo_base_finalize(Eo *obj, Eo_Base_Data *pd EINA_UNUSED)
{
- return _eo_add_internal_end(obj);
+ return obj;
}
EOLIAN static void
/* Free all the entries and the tables */
static inline void _eo_free_ids_tables(void);
-Eo *_eo_add_internal_end(Eo *obj);
void _eo_condtor_done(Eo *obj);
struct _Eo_Base
int refcount;
int datarefcount;
- Eina_Bool do_error:1;
Eina_Bool condtor_done:1;
Eina_Bool finalized:1;
}
static Eina_Bool
-_init_cow(Eo *eo_obj)
+_init_cow(void)
{
if (!evas_object_image_load_opts_cow ||
!evas_object_image_pixels_cow ||
!evas_object_image_pixels_cow ||
!evas_object_image_state_cow)
{
- eo_error_set(eo_obj);
+ ERR("Failed to init cow.");
return EINA_FALSE;
}
evas_object_image_init(eo_obj);
evas_object_inject(eo_obj, obj, eo_e);
- if (!_init_cow(eo_obj))
+ if (!_init_cow())
return NULL;
o->load_opts = eina_cow_alloc(evas_object_image_load_opts_cow);
if (!obj || !_init_cow() || !eo_isa(parent, EVAS_COMMON_INTERFACE_INTERFACE))
{
- eo_error_set(eo_obj);
+ ERR("Failed");
return NULL;
}
obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
- if (!_efl_vg_base_parent_checked_get(obj, &parent, &cd))
- eo_error_set(obj);
+ if (!_efl_vg_base_parent_checked_get(obj, &parent, &cd)) {
+ ERR("Failed");
+ return NULL;
+ }
eo_do(obj, eo_event_callback_add(EFL_GFX_CHANGED, _efl_vg_base_property_changed, pd));
pd->changed = EINA_TRUE;
return ;
on_error:
- eo_error_set(obj);
return ;
}
return ;
on_error:
- eo_error_set(obj);
+ ERR("Err");
}
static void
return ;
on_error:
- eo_error_set(obj);
+ ERR("Err");
}
static void
return ;
on_error:
- eo_error_set(obj);
+ ERR("Err");
}
static void
return ;
on_error:
- eo_error_set(obj);
+ ERR("Err");
}
static Eo *
eo_do_super(obj, EFL_VG_BASE_CLASS, eo_parent_set(parent));
if (parent && !eo_isa(parent, EVAS_VG_CLASS))
{
- eo_error_set(obj);
+ ERR("Parent of VG_ROOT_NODE must be a VG_CLASS");
}
else
{
// Nice little hack, jump over parent constructor in Efl_VG_Root
obj = eo_do_super_ret(obj, EFL_VG_BASE_CLASS, obj, eo_constructor());
eo_do(obj, parent = eo_parent_get());
- if (!eo_isa(parent, EVAS_VG_CLASS))
- eo_error_set(obj);
+ if (!eo_isa(parent, EVAS_VG_CLASS)) {
+ ERR("Parent of VG_ROOT_NODE must be a VG_CLASS");
+ return NULL;
+ }
cd = eo_data_scope_get(obj, EFL_VG_CONTAINER_CLASS);
cd->children = NULL;
Eo *ret;
Private_Data *pd = class_data;
- if (pd->a < 0) eo_error_set(obj);
-
eo_do_super(obj, MY_CLASS, ret = eo_finalize());
+ if (pd->a < 0)
+ {
+ return NULL;
+ }
+
return ret;
}
{
obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
- eo_error_set(obj);
- return obj;
+ return NULL;
}
static Eo_Op_Description op_descs[] = {
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_destructor());
-
- eo_error_set(obj);
}
static Eo_Op_Description op_descs [] = {
fail_if(wref);
fail_if(parent);
- eo_error_set((Eo *) buf);
-
fail_if(eo_data_scope_get((Eo *) buf, SIMPLE_CLASS));
eo_do(obj, eo_composite_attach((Eo *) buf));