summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ecore/efl_view_model.c2
-rw-r--r--src/lib/efl/interfaces/efl_model.eo4
-rw-r--r--src/lib/efl/interfaces/efl_mvvm_common.c10
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c23
-rw-r--r--src/lib/elementary/efl_ui_layout.c15
-rw-r--r--src/lib/elementary/efl_ui_widget.c4
6 files changed, 35 insertions, 23 deletions
diff --git a/src/lib/ecore/efl_view_model.c b/src/lib/ecore/efl_view_model.c
index 76f2405b28..7bb9a34673 100644
--- a/src/lib/ecore/efl_view_model.c
+++ b/src/lib/ecore/efl_view_model.c
@@ -304,7 +304,7 @@ _efl_view_model_property_changed(void *data, const Efl_Event *event)
304 304
305 eina_array_push(nev.changed_properties, property); 305 eina_array_push(nev.changed_properties, property);
306 306
307 src = eina_stringshare_add(property); 307 src = eina_stringshare_ref(property);
308 bind = _efl_view_model_property_bind_lookup(pd, src); 308 bind = _efl_view_model_property_bind_lookup(pd, src);
309 if (bind) 309 if (bind)
310 { 310 {
diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo
index 82f4a92b40..29dbf9775c 100644
--- a/src/lib/efl/interfaces/efl_model.eo
+++ b/src/lib/efl/interfaces/efl_model.eo
@@ -1,7 +1,7 @@
1struct @beta Efl.Model_Property_Event { 1struct @beta Efl.Model_Property_Event {
2 [[EFL model property event data structure]] 2 [[EFL model property event data structure]]
3 changed_properties: array<string>; [[List of changed properties]] 3 changed_properties: array<stringshare>; [[List of changed properties]]
4 invalidated_properties: array<string>; [[Removed properties identified by name]] 4 invalidated_properties: array<stringshare>; [[Removed properties identified by name]]
5} 5}
6 6
7struct @beta Efl.Model_Children_Event { 7struct @beta Efl.Model_Children_Event {
diff --git a/src/lib/efl/interfaces/efl_mvvm_common.c b/src/lib/efl/interfaces/efl_mvvm_common.c
index 2fb9118ebd..a2c7fa4f8d 100644
--- a/src/lib/efl/interfaces/efl_mvvm_common.c
+++ b/src/lib/efl/interfaces/efl_mvvm_common.c
@@ -62,6 +62,7 @@ _efl_model_properties_changed_internal(const Efl_Model *model, ...)
62{ 62{
63 Efl_Model_Property_Event ev = { 0 }; 63 Efl_Model_Property_Event ev = { 0 };
64 Eina_Array *properties = eina_array_new(1); 64 Eina_Array *properties = eina_array_new(1);
65 Eina_Stringshare *sp;
65 const char *property; 66 const char *property;
66 va_list args; 67 va_list args;
67 68
@@ -69,7 +70,7 @@ _efl_model_properties_changed_internal(const Efl_Model *model, ...)
69 70
70 while ((property = (const char*) va_arg(args, const char*))) 71 while ((property = (const char*) va_arg(args, const char*)))
71 { 72 {
72 eina_array_push(properties, property); 73 eina_array_push(properties, eina_stringshare_add(property));
73 } 74 }
74 75
75 va_end(args); 76 va_end(args);
@@ -78,6 +79,8 @@ _efl_model_properties_changed_internal(const Efl_Model *model, ...)
78 79
79 efl_event_callback_call((Efl_Model *) model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &ev); 80 efl_event_callback_call((Efl_Model *) model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &ev);
80 81
82 while ((sp = eina_array_pop(properties)))
83 eina_stringshare_del(sp);
81 eina_array_free(properties); 84 eina_array_free(properties);
82} 85}
83 86
@@ -87,13 +90,16 @@ efl_model_property_invalidated_notify(Efl_Model *model, const char *property)
87 Eina_Array *invalidated_properties = eina_array_new(1); 90 Eina_Array *invalidated_properties = eina_array_new(1);
88 EINA_SAFETY_ON_NULL_RETURN(invalidated_properties); 91 EINA_SAFETY_ON_NULL_RETURN(invalidated_properties);
89 92
90 Eina_Bool ret = eina_array_push(invalidated_properties, property); 93 Eina_Stringshare *sp = eina_stringshare_add(property);
94
95 Eina_Bool ret = eina_array_push(invalidated_properties, sp);
91 EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); 96 EINA_SAFETY_ON_FALSE_GOTO(ret, on_error);
92 97
93 Efl_Model_Property_Event evt = {.invalidated_properties = invalidated_properties}; 98 Efl_Model_Property_Event evt = {.invalidated_properties = invalidated_properties};
94 efl_event_callback_call(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &evt); 99 efl_event_callback_call(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &evt);
95 100
96on_error: 101on_error:
102 eina_stringshare_del(sp);
97 eina_array_free(invalidated_properties); 103 eina_array_free(invalidated_properties);
98} 104}
99 105
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index 32253e36a7..d571732fc8 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -530,6 +530,7 @@ _eldbus_model_proxy_property_get_all_load(const Eldbus_Message *msg, Eldbus_Mode
530 Eldbus_Message_Iter *values = NULL; 530 Eldbus_Message_Iter *values = NULL;
531 Eldbus_Message_Iter *entry; 531 Eldbus_Message_Iter *entry;
532 Eina_Array *changed_properties; 532 Eina_Array *changed_properties;
533 Eina_Stringshare *tmp = NULL;
533 const char *error_name, *error_text; 534 const char *error_name, *error_text;
534 535
535 if (eldbus_message_error_get(msg, &error_name, &error_text)) 536 if (eldbus_message_error_get(msg, &error_name, &error_text))
@@ -547,7 +548,6 @@ _eldbus_model_proxy_property_get_all_load(const Eldbus_Message *msg, Eldbus_Mode
547 changed_properties = eina_array_new(1); 548 changed_properties = eina_array_new(1);
548 while (eldbus_message_iter_get_and_next(values, 'e', &entry)) 549 while (eldbus_message_iter_get_and_next(values, 'e', &entry))
549 { 550 {
550 Eina_Stringshare *tmp;
551 const char *property; 551 const char *property;
552 Eldbus_Message_Iter *variant; 552 Eldbus_Message_Iter *variant;
553 Eina_Value *struct_value; 553 Eina_Value *struct_value;
@@ -567,7 +567,6 @@ _eldbus_model_proxy_property_get_all_load(const Eldbus_Message *msg, Eldbus_Mode
567 567
568 tmp = eina_stringshare_add(property); 568 tmp = eina_stringshare_add(property);
569 prop_value = eina_hash_find(pd->properties, tmp); 569 prop_value = eina_hash_find(pd->properties, tmp);
570 eina_stringshare_del(tmp);
571 if (!prop_value) goto on_error; 570 if (!prop_value) goto on_error;
572 571
573 ret = eina_value_copy(&arg0, prop_value); 572 ret = eina_value_copy(&arg0, prop_value);
@@ -575,14 +574,20 @@ _eldbus_model_proxy_property_get_all_load(const Eldbus_Message *msg, Eldbus_Mode
575 574
576 eina_value_flush(&arg0); 575 eina_value_flush(&arg0);
577 576
578 ret = eina_array_push(changed_properties, property); 577 ret = eina_array_push(changed_properties, tmp);
579 if (!ret) goto on_error; 578 if (!ret) goto on_error;
579
580 // Reset tmp to NULL to avoid double free.
581 tmp = NULL;
580 } 582 }
581 583
582 pd->is_loaded = EINA_TRUE; 584 pd->is_loaded = EINA_TRUE;
583 return changed_properties; 585 return changed_properties;
584 586
585 on_error: 587 on_error:
588 eina_stringshare_del(tmp);
589 while ((tmp = eina_array_pop(changed_properties)))
590 eina_stringshare_del(tmp);
586 eina_array_free(changed_properties); 591 eina_array_free(changed_properties);
587 return NULL; 592 return NULL;
588} 593}
@@ -603,6 +608,7 @@ _eldbus_model_proxy_property_get_all_cb(void *data,
603{ 608{
604 Eldbus_Model_Proxy_Data *pd = (Eldbus_Model_Proxy_Data*)data; 609 Eldbus_Model_Proxy_Data *pd = (Eldbus_Model_Proxy_Data*)data;
605 Eldbus_Property_Promise* p; 610 Eldbus_Property_Promise* p;
611 Eina_Stringshare *sp;
606 Eina_Array *properties; 612 Eina_Array *properties;
607 Efl_Model_Property_Event evt; 613 Efl_Model_Property_Event evt;
608 614
@@ -623,6 +629,8 @@ _eldbus_model_proxy_property_get_all_cb(void *data,
623 629
624 evt.changed_properties = properties; 630 evt.changed_properties = properties;
625 efl_event_callback_call(pd->obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &evt); 631 efl_event_callback_call(pd->obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &evt);
632 while ((sp = eina_array_pop(properties)))
633 eina_stringshare_del(sp);
626 eina_array_free(properties); 634 eina_array_free(properties);
627} 635}
628 636
@@ -635,6 +643,7 @@ _eldbus_model_proxy_property_set_load_cb(void *data,
635 Eldbus_Model_Proxy_Property_Set_Data *set_data = (Eldbus_Model_Proxy_Property_Set_Data *)data; 643 Eldbus_Model_Proxy_Property_Set_Data *set_data = (Eldbus_Model_Proxy_Property_Set_Data *)data;
636 Eldbus_Model_Proxy_Data *pd = set_data->pd; 644 Eldbus_Model_Proxy_Data *pd = set_data->pd;
637 Eina_Array *properties; 645 Eina_Array *properties;
646 Eina_Stringshare *sp;
638 const char *signature; 647 const char *signature;
639 648
640 pd->pendings = eina_list_remove(pd->pendings, pending); 649 pd->pendings = eina_list_remove(pd->pendings, pending);
@@ -645,16 +654,18 @@ _eldbus_model_proxy_property_set_load_cb(void *data,
645 if (!signature || !properties) 654 if (!signature || !properties)
646 { 655 {
647 eina_promise_reject(set_data->promise, EFL_MODEL_ERROR_UNKNOWN); 656 eina_promise_reject(set_data->promise, EFL_MODEL_ERROR_UNKNOWN);
648 eina_array_free(properties);
649 _eldbus_model_proxy_property_set_data_free(set_data); 657 _eldbus_model_proxy_property_set_data_free(set_data);
650 return; 658 goto end;
651 } 659 }
652 660
653 eina_array_free(properties);
654 pending = eldbus_proxy_property_value_set(pd->proxy, set_data->property, 661 pending = eldbus_proxy_property_value_set(pd->proxy, set_data->property,
655 signature, set_data->value, 662 signature, set_data->value,
656 _eldbus_model_proxy_property_set_cb, set_data); 663 _eldbus_model_proxy_property_set_cb, set_data);
657 pd->pendings = eina_list_append(pd->pendings, pending); 664 pd->pendings = eina_list_append(pd->pendings, pending);
665 end:
666 while ((sp = eina_array_pop(properties)))
667 eina_stringshare_del(sp);
668 eina_array_free(properties);
658} 669}
659 670
660 671
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index f6f725eb9c..8c6e69abcf 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2179,21 +2179,18 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
2179 2179
2180 EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) 2180 EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it)
2181 { 2181 {
2182 Eina_Stringshare *sprop = eina_stringshare_add(prop);
2183 const char *part; 2182 const char *part;
2184 const char *signal; 2183 const char *signal;
2185 Efl_Ui_Layout_Factory_Tracking *factory; 2184 Efl_Ui_Layout_Factory_Tracking *factory;
2186 2185
2187 part = eina_hash_find(pd->connect.properties, sprop); 2186 part = eina_hash_find(pd->connect.properties, prop);
2188 if (part) _efl_ui_layout_view_model_property_update(pd, part, sprop); 2187 if (part) _efl_ui_layout_view_model_property_update(pd, part, prop);
2189 2188
2190 signal = eina_hash_find(pd->connect.signals, sprop); 2189 signal = eina_hash_find(pd->connect.signals, prop);
2191 if (signal) _efl_ui_layout_view_model_signal_update(pd, signal, sprop); 2190 if (signal) _efl_ui_layout_view_model_signal_update(pd, signal, prop);
2192 2191
2193 factory = eina_hash_find(pd->connect.factories, sprop); 2192 factory = eina_hash_find(pd->connect.factories, prop);
2194 if (factory) _efl_ui_layout_view_model_content_update(pd, factory, sprop); 2193 if (factory) _efl_ui_layout_view_model_content_update(pd, factory, prop);
2195
2196 eina_stringshare_del(sprop);
2197 } 2194 }
2198} 2195}
2199 2196
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 86c2db8e97..25462ceb02 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -6010,12 +6010,10 @@ _efl_ui_model_property_bind_changed(void *data, const Efl_Event *event)
6010 6010
6011 EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) 6011 EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it)
6012 { 6012 {
6013 Eina_Stringshare *sp = eina_stringshare_add(prop);
6014 Efl_Ui_Property_Bound *lookup; 6013 Efl_Ui_Property_Bound *lookup;
6015 6014
6016 lookup = eina_hash_find(pd->properties.model_lookup, sp); 6015 lookup = eina_hash_find(pd->properties.model_lookup, prop);
6017 if (lookup) _efl_ui_property_bind_get(pd, lookup); 6016 if (lookup) _efl_ui_property_bind_get(pd, lookup);
6018 eina_stringshare_del(sp);
6019 } 6017 }
6020} 6018}
6021 6019