mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
fix memory leak
This commit is contained in:
parent
98e7824a6b
commit
56ed573ecb
@ -5,6 +5,8 @@
|
||||
* 修复demoui kb\_ascii软键盘输入内容错误问题(感谢兆坤提供补丁)。
|
||||
* 将page\_tab\_ctrl中的view改为tab\_control,让xml更具有可读性(感谢兆坤提供补丁)。
|
||||
* 修复mledit选择文本时鼠标指针拖到滚动条上的滑块后,再拖回mledit时无法继续选择文本的问题(感谢兆坤提供补丁)。
|
||||
* 修复SDL\_DestroyWindow后SDL\_GL\_DeleteContext无法正常释放导致泄漏的问题(感谢朝泽提供补丁)
|
||||
* 修复data\_reader\_factory、data\_writer\_factory重复register会引起内存泄漏的问题(感谢朝泽提供补丁)
|
||||
|
||||
2021/12/26
|
||||
* 增加函数array\_reverse
|
||||
|
@ -189,14 +189,14 @@ static ret_t native_window_sdl_close(native_window_t* win) {
|
||||
SDL_DestroyRenderer(sdl->render);
|
||||
}
|
||||
|
||||
if (sdl->window != NULL) {
|
||||
SDL_DestroyWindow(sdl->window);
|
||||
}
|
||||
|
||||
if (sdl->context != NULL) {
|
||||
SDL_GL_DeleteContext(sdl->context);
|
||||
}
|
||||
|
||||
if (sdl->window != NULL) {
|
||||
SDL_DestroyWindow(sdl->window);
|
||||
}
|
||||
|
||||
sdl->render = NULL;
|
||||
sdl->window = NULL;
|
||||
sdl->context = NULL;
|
||||
|
@ -61,12 +61,19 @@ ret_t data_reader_factory_register(data_reader_factory_t* factory, const char* p
|
||||
creator_item_t* item = NULL;
|
||||
return_value_if_fail(factory != NULL && protocol != NULL && create != NULL, RET_BAD_PARAMS);
|
||||
|
||||
item = TKMEM_ZALLOC(creator_item_t);
|
||||
return_value_if_fail(item != NULL, RET_OOM);
|
||||
item = darray_find(&(factory->creators), (void*)protocol);
|
||||
if (item != NULL) {
|
||||
if (item->create != create) {
|
||||
item->create = create;
|
||||
}
|
||||
} else {
|
||||
item = TKMEM_ZALLOC(creator_item_t);
|
||||
return_value_if_fail(item != NULL, RET_OOM);
|
||||
|
||||
item->create = create;
|
||||
tk_strncpy(item->protocol, protocol, TK_NAME_LEN);
|
||||
darray_push(&(factory->creators), item);
|
||||
item->create = create;
|
||||
tk_strncpy(item->protocol, protocol, TK_NAME_LEN);
|
||||
darray_push(&(factory->creators), item);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -61,12 +61,19 @@ ret_t data_writer_factory_register(data_writer_factory_t* factory, const char* p
|
||||
creator_item_t* item = NULL;
|
||||
return_value_if_fail(factory != NULL && protocol != NULL && create != NULL, RET_BAD_PARAMS);
|
||||
|
||||
item = TKMEM_ZALLOC(creator_item_t);
|
||||
return_value_if_fail(item != NULL, RET_OOM);
|
||||
item = darray_find(&(factory->creators), (void*)protocol);
|
||||
if (item != NULL) {
|
||||
if (item->create != create) {
|
||||
item->create = create;
|
||||
}
|
||||
} else {
|
||||
item = TKMEM_ZALLOC(creator_item_t);
|
||||
return_value_if_fail(item != NULL, RET_OOM);
|
||||
|
||||
item->create = create;
|
||||
tk_strncpy(item->protocol, protocol, TK_NAME_LEN);
|
||||
darray_push(&(factory->creators), item);
|
||||
item->create = create;
|
||||
tk_strncpy(item->protocol, protocol, TK_NAME_LEN);
|
||||
darray_push(&(factory->creators), item);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user