forked from enlightenment/efl
Evas filters: Fix COW usage.
Thanks cedric for the report. We'll need a new function (after 1.12) to detect if the current cow pointer is the default data or not. Maybe eina_cow_default_get() or maybe something just returning a bool.
This commit is contained in:
parent
f3226f5e81
commit
251389fefd
|
@ -35,6 +35,7 @@ static const Evas_Object_Protected_State default_state = {
|
|||
static const Evas_Object_Filter_Data default_filter = {
|
||||
NULL, NULL, NULL, NULL, EINA_FALSE, EINA_FALSE
|
||||
};
|
||||
const void * const evas_object_filter_cow_default = &default_filter;
|
||||
|
||||
Eina_Cow *evas_object_proxy_cow = NULL;
|
||||
Eina_Cow *evas_object_map_cow = NULL;
|
||||
|
|
|
@ -403,7 +403,8 @@ _evas_text_efl_text_properties_font_source_get(Eo *eo_obj EINA_UNUSED, Evas_Text
|
|||
static inline void
|
||||
_evas_text_filter_changed_set(Evas_Text_Data *o, Eina_Bool val)
|
||||
{
|
||||
if (o->cur.filter && (o->cur.filter->changed != val))
|
||||
if ((evas_object_filter_cow_default != o->cur.filter)
|
||||
&& (o->cur.filter->changed != val))
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
fcow->changed = val;
|
||||
|
@ -1542,17 +1543,21 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
|||
Evas_Text_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
|
||||
|
||||
/* free filter output */
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
if (fcow->output)
|
||||
ENFN->image_free(ENDT, fcow->output);
|
||||
eina_hash_free(fcow->sources);
|
||||
evas_filter_program_del(fcow->chain);
|
||||
eina_stringshare_del(fcow->code);
|
||||
fcow->output = NULL;
|
||||
fcow->chain = NULL;
|
||||
fcow->sources = NULL;
|
||||
fcow->code = NULL;
|
||||
EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
|
||||
if (evas_object_filter_cow_default != o->cur.filter)
|
||||
{
|
||||
EINA_COW_WRITE_BEGIN(evas_object_filter_cow, o->cur.filter, Evas_Object_Filter_Data, fcow)
|
||||
if (fcow->output)
|
||||
ENFN->image_free(ENDT, fcow->output);
|
||||
eina_hash_free(fcow->sources);
|
||||
evas_filter_program_del(fcow->chain);
|
||||
eina_stringshare_del(fcow->code);
|
||||
fcow->output = NULL;
|
||||
fcow->chain = NULL;
|
||||
fcow->sources = NULL;
|
||||
fcow->code = NULL;
|
||||
EINA_COW_WRITE_END(evas_object_filter_cow, o->cur.filter, fcow);
|
||||
eina_cow_free(evas_object_filter_cow, (const Eina_Cow_Data **) &o->cur.filter);
|
||||
}
|
||||
|
||||
/* free obj */
|
||||
_evas_object_text_items_clear(o);
|
||||
|
|
|
@ -1715,6 +1715,8 @@ extern Eina_Cow *evas_object_image_load_opts_cow;
|
|||
extern Eina_Cow *evas_object_image_state_cow;
|
||||
|
||||
extern Eina_Cow *evas_object_filter_cow;
|
||||
// This should be replaced by something like "eina_cow_default_get()" maybe
|
||||
extern const void * const evas_object_filter_cow_default;
|
||||
|
||||
# define EINA_COW_STATE_WRITE_BEGIN(Obj, Write, State) \
|
||||
EINA_COW_WRITE_BEGIN(evas_object_state_cow, Obj->State, \
|
||||
|
|
Loading…
Reference in New Issue