fix memory leak

This commit is contained in:
xianjimli 2019-01-03 11:23:32 +08:00
parent afbc31d9d3
commit 1099c04fa5
2 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* 2019/01/03
* 同步SDL代码。
* 整理API文档timer/idle
* 用valgrind测试内存问题并修改progress\_circle中的内存泄露问题。
* 2019/01/02
* 整理API文档input\_method/input\_method\_default/input\_method\_sdl/input\_method\_null

View File

@ -155,6 +155,14 @@ ret_t progress_circle_set_counter_clock_wise(widget_t* widget, bool_t counter_cl
return widget_invalidate(widget, NULL);
}
static ret_t progress_circle_on_destroy(widget_t* widget) {
progress_circle_t* progress_circle = PROGRESS_CIRCLE(widget);
TKMEM_FREE(progress_circle->uint);
return RET_OK;
}
static ret_t progress_circle_get_prop(widget_t* widget, const char* name, value_t* v) {
progress_circle_t* progress_circle = PROGRESS_CIRCLE(widget);
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
@ -221,6 +229,7 @@ static const widget_vtable_t s_progress_circle_vtable = {
.clone_properties = s_progress_circle_clone_properties,
.create = progress_circle_create,
.on_paint_self = progress_circle_on_paint_self,
.get_prop = progress_circle_on_destroy,
.get_prop = progress_circle_get_prop,
.set_prop = progress_circle_set_prop};