elm: Forbid calls to efl_part(obj, NULL)

This in theory should only affect the EO API usage. In EO
we don't want efl_part() to be used for NULL part. In other
words, there is no "default" part in EO objects. Instead, those
functions like text_set or content_set should simply be
implemented by the object themselves.

The legacy API on the other hand will make sure that the
"part" argument is set to a non-NULL value before reaching
this point.
This commit is contained in:
Jean-Philippe Andre 2017-07-05 20:12:14 +09:00
parent 075b4a7a0c
commit 9b667ed062
2 changed files with 5 additions and 3 deletions

View File

@ -2381,7 +2381,7 @@ _elm_layout_efl_part_part(const Eo *obj, Elm_Layout_Smart_Data *sd EINA_UNUSED,
{
pd->obj = (Eo *) obj;
pd->sd = efl_data_xref(pd->obj, ELM_LAYOUT_CLASS, proxy);
pd->part = part ? strdup(part) : NULL;
pd->part = strdup(part);
pd->temp = 1;
}

View File

@ -43,13 +43,14 @@ _ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const cha
partdata *pd; \
Eo *proxy; \
\
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
proxy = efl_add(TYPE ## _INTERNAL_PART_CLASS, (Eo *) obj); \
pd = efl_data_scope_get(proxy, TYPE ## _INTERNAL_PART_CLASS); \
if (pd) \
{ \
pd->obj = (Eo *) obj; \
pd->sd = efl_data_xref(pd->obj, TYPE ## _CLASS, proxy); \
pd->part = part ? strdup(part) : NULL; \
pd->part = strdup(part); \
pd->temp = 1; \
} \
\
@ -111,13 +112,14 @@ _ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const cha
partdata *pd; \
Eo *proxy; \
\
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
proxy = efl_add(TYPE ## _INTERNAL_PART_CLASS, (Eo *) obj); \
pd = efl_data_scope_get(proxy, SUPER ## _INTERNAL_PART_CLASS); \
if (pd) \
{ \
pd->obj = (Eo *) obj; \
pd->sd = efl_data_xref(pd->obj, SUPER ## _CLASS, proxy); \
pd->part = part ? strdup(part) : NULL; \
pd->part = strdup(part); \
pd->temp = 1; \
} \
\