forked from enlightenment/efl
elm - be more robust in the face of null cnp obj and bad app code
someone decided passing a null obj to elm_cnp_selection_set from an app is a good idea. it's not... but let's not crash 9nside efl if someone does and instead survive and complain @fix
This commit is contained in:
parent
da0a6f9ed0
commit
4ba44bd865
|
@ -9226,6 +9226,7 @@ _ui_buffer_get(Ecore_Evas_Selection_Buffer buffer)
|
||||||
void
|
void
|
||||||
_register_selection_changed(Efl_Ui_Selection *selection)
|
_register_selection_changed(Efl_Ui_Selection *selection)
|
||||||
{
|
{
|
||||||
|
if (!selection) return;
|
||||||
ELM_WIN_DATA_GET(efl_provider_find(selection, EFL_UI_WIN_CLASS), pd);
|
ELM_WIN_DATA_GET(efl_provider_find(selection, EFL_UI_WIN_CLASS), pd);
|
||||||
|
|
||||||
eina_array_push(pd->planned_changes, selection);
|
eina_array_push(pd->planned_changes, selection);
|
||||||
|
|
|
@ -127,6 +127,18 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
|
||||||
Eina_Array *tmp;
|
Eina_Array *tmp;
|
||||||
unsigned char *mem_buf = NULL;
|
unsigned char *mem_buf = NULL;
|
||||||
|
|
||||||
|
if (!obj)
|
||||||
|
{
|
||||||
|
ERR("elm_cnp_selection_set() passed NULL object");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
||||||
|
if (!ee)
|
||||||
|
{
|
||||||
|
ERR("elm_cnp_selection_set() can't fine ecore_evas for obj %p", obj);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (format == ELM_SEL_FORMAT_TEXT && ((char*)buf)[buflen - 1] != '\0')
|
if (format == ELM_SEL_FORMAT_TEXT && ((char*)buf)[buflen - 1] != '\0')
|
||||||
{
|
{
|
||||||
mem_buf = eina_memdup((unsigned char *)buf, buflen, EINA_TRUE);
|
mem_buf = eina_memdup((unsigned char *)buf, buflen, EINA_TRUE);
|
||||||
|
@ -139,8 +151,6 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
|
||||||
data.len = buflen;
|
data.len = buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
||||||
|
|
||||||
if (format == ELM_SEL_FORMAT_IMAGE)
|
if (format == ELM_SEL_FORMAT_IMAGE)
|
||||||
{
|
{
|
||||||
tmp = _elm_sel_from_content_to_mime_type(buf, buflen);
|
tmp = _elm_sel_from_content_to_mime_type(buf, buflen);
|
||||||
|
|
Loading…
Reference in New Issue