yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=d7785eb3c97811dde333dd09b62c8057565eebf9

commit d7785eb3c97811dde333dd09b62c8057565eebf9
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Mon Jan 25 12:50:26 2016 +0200

    Fix setting empty string in text fields
    
    When setting empty string in text field NULL will be assigned.
---
 src/lib/gui_widget.c | 3 +--
 src/lib/gui_widget.h | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/lib/gui_widget.c b/src/lib/gui_widget.c
index 682feeb..073a880 100644
--- a/src/lib/gui_widget.c
+++ b/src/lib/gui_widget.c
@@ -3123,8 +3123,7 @@ void
 gui_value_string_set(Gui_Value *val, const char *str)
 {
    val->type = GUI_TYPE_STRING;
-   if (str)
-     val->string = strdup(str);
+   val->string = str ? strdup(str) : NULL;
 }
 
 void
diff --git a/src/lib/gui_widget.h b/src/lib/gui_widget.h
index f7adb44..d1af747 100644
--- a/src/lib/gui_widget.h
+++ b/src/lib/gui_widget.h
@@ -47,7 +47,11 @@ typedef struct _Item_Container_Item Item_Container_Item;
         {\
            void *__p = gui_value_pointer_get(value);\
            char *__s = *(char**)(__p);\
-           if (__s) free(__s);\
+           if (__s)\
+            {\
+               free(__s);\
+               *(char**)(__p) = NULL;\
+            }\
         }\
 
 #define DOUBLE_GET(val) (*((double *) gui_value_pointer_get((val))))

-- 


Reply via email to