fix widget_set_state scripting binding bug.

This commit is contained in:
lixianjing 2019-12-07 07:10:48 +08:00
parent bcc1091b7b
commit f35b31581d
3 changed files with 12 additions and 5 deletions

View File

@ -1,8 +1,14 @@
# 最新动态
* 2019/12/07
* 修改 widget\_set\_state 脚本绑定时的问题(感谢大恒提供补丁)。
* 2019/12/06
* 完善脚本绑定。
* 2019/12/05
* 修改了image_animation控件的format、sequence属性设置为空字符串时设为空避免显示有误感谢朝泽提供补丁
* 增加文档how_to_use_mutable_image.md感谢智明提供补丁
* 修改了 image_animation 控件的 format、sequence 属性设置,为空字符串时设为空,避免显示有误(感谢朝泽提供补丁)。
* 增加文档 how\_to\_use\_mutable\_image.md感谢智明提供补丁
* 2019/12/04
* awtk 增加对 lcd 为 rgb888 的支持 (感谢智明提供补丁)。

View File

@ -138,6 +138,7 @@ static ret_t widget_real_destroy(widget_t* widget) {
}
TKMEM_FREE(widget->name);
TKMEM_FREE(widget->state);
TKMEM_FREE(widget->style);
TKMEM_FREE(widget->tr_text);
TKMEM_FREE(widget->animation);
@ -633,7 +634,7 @@ ret_t widget_set_state(widget_t* widget, const char* state) {
if (!tk_str_eq(widget->state, state)) {
widget_invalidate_force(widget, NULL);
widget->state = state;
widget->state = tk_str_copy(widget->state, state);
widget_set_need_update_style(widget);
widget_invalidate_force(widget, NULL);
}
@ -2669,7 +2670,7 @@ widget_t* widget_init(widget_t* widget, widget_t* parent, const widget_vtable_t*
widget->emitter = NULL;
widget->children = NULL;
widget->initializing = TRUE;
widget->state = WIDGET_STATE_NORMAL;
widget->state = tk_str_copy(widget->state, WIDGET_STATE_NORMAL);
widget->target = NULL;
widget->key_target = NULL;
widget->grab_widget = NULL;

View File

@ -384,7 +384,7 @@ struct _widget_t {
* @annotation ["readable"]
* (widget_state_t)
*/
const char* state;
char* state;
/**
* @property {uint8_t} opacity
* @annotation ["readable"]