jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b369989a7994bf03a77cd3f66d70a638ea0cd837

commit b369989a7994bf03a77cd3f66d70a638ea0cd837
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Mon Feb 29 17:04:13 2016 +0900

    Evas filters: Fix bad stringshare usage
    
    Make sure the filter uses properly initialized state names and
    don't call stringshare_del on a static string.
---
 src/lib/evas/canvas/evas_filter_mixin.c | 11 ++++++++++-
 src/lib/evas/canvas/evas_object_main.c  |  2 +-
 src/lib/evas/include/evas_private.h     | 10 +++++-----
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/lib/evas/canvas/evas_filter_mixin.c 
b/src/lib/evas/canvas/evas_filter_mixin.c
index eb2f557..41c55ab 100644
--- a/src/lib/evas/canvas/evas_filter_mixin.c
+++ b/src/lib/evas/canvas/evas_filter_mixin.c
@@ -11,7 +11,7 @@
 #define ENFN obj->layer->evas->engine.func
 #define ENDT obj->layer->evas->engine.data.output
 
-#define FCOW_BEGIN(_pd) eina_cow_write(evas_object_filter_cow, (const 
Eina_Cow_Data**)&(_pd->data))
+#define FCOW_BEGIN(_pd) ({ Evas_Object_Filter_Data *_fcow = 
eina_cow_write(evas_object_filter_cow, (const Eina_Cow_Data**)&(_pd->data)); 
_state_check(_fcow); _fcow; })
 #define FCOW_END(_fcow, _pd) eina_cow_done(evas_object_filter_cow, (const 
Eina_Cow_Data**)&(_pd->data), _fcow, EINA_TRUE)
 
 typedef struct _Evas_Filter_Data Evas_Filter_Data;
@@ -31,6 +31,15 @@ struct _Evas_Filter_Post_Render_Data
    Eina_Bool success;
 };
 
+static inline void
+_state_check(Evas_Object_Filter_Data *fcow)
+{
+   if (!fcow->state.cur.name)
+     fcow->state.cur.name = eina_stringshare_add("default");
+   if (!fcow->state.next.name)
+     fcow->state.next.name = eina_stringshare_add("default");
+}
+
 static void
 _filter_end_sync(Evas_Filter_Context *ctx, Evas_Object_Protected_Data *obj,
                  Evas_Filter_Data *pd, Eina_Bool success)
diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index 154d93b..f0a149c 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -33,7 +33,7 @@ static const Evas_Object_Protected_State default_state = {
   1.0, 0, EVAS_RENDER_BLEND, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE, 
EINA_FALSE
 };
 static const Evas_Object_Filter_Data default_filter = {
-  NULL, NULL, NULL, NULL, NULL, NULL, { { "default", 0.0 }, { "default", 0.0 
}, 0.0 }, EINA_FALSE, EINA_FALSE, EINA_TRUE
+  NULL, NULL, NULL, NULL, NULL, NULL, { { NULL, 0.0 }, { NULL, 0.0 }, 0.0 }, 
EINA_FALSE, EINA_FALSE, EINA_TRUE
 };
 const void * const evas_object_filter_cow_default = &default_filter;
 static const Evas_Object_Mask_Data default_mask = {
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index c5146f4..4e60fa4 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1191,14 +1191,14 @@ struct _Evas_Object_Filter_Data
    void                *output;
    struct {
       struct {
-         const char    *name;
-         double         value;
+         Eina_Stringshare *name;
+         double            value;
       } cur;
       struct {
-         const char    *name;
-         double         value;
+         Eina_Stringshare *name;
+         double            value;
       } next;
-      double            pos;
+      double               pos;
    } state;
    Eina_Bool            changed : 1;
    Eina_Bool            invalid : 1; // Code parse failed

-- 


Reply via email to