mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-08 19:44:45 +08:00
memory leak found by valgrind
This commit is contained in:
parent
71bb25203a
commit
74724ac9ce
@ -34,6 +34,13 @@ bitmap_t* bitmap_create(void) {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
ret_t bitmap_destroy_with_self(bitmap_t* bitmap) {
|
||||
return_value_if_fail(bitmap != NULL, RET_BAD_PARAMS);
|
||||
bitmap->should_free_handle = TRUE;
|
||||
|
||||
return bitmap_destroy(bitmap);
|
||||
}
|
||||
|
||||
ret_t bitmap_destroy(bitmap_t* bitmap) {
|
||||
return_value_if_fail(bitmap != NULL, RET_BAD_PARAMS);
|
||||
|
||||
|
@ -260,10 +260,20 @@ bool_t bitmap_save_png(bitmap_t* bitmap, const char* filename);
|
||||
*/
|
||||
ret_t bitmap_mono_dump(const uint8_t* buff, uint32_t w, uint32_t h);
|
||||
|
||||
/**
|
||||
* @method bitmap_destroy_with_self
|
||||
* 销毁图片(for script only)。
|
||||
* @alias bitmap_destroy
|
||||
* @annotation ["deconstructor", "scriptable", "gc"]
|
||||
* @param {bitmap_t*} bitmap bitmap对象。
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t bitmap_destroy_with_self(bitmap_t* bitmap);
|
||||
|
||||
/**
|
||||
* @method bitmap_destroy
|
||||
* 销毁图片。
|
||||
* @annotation ["deconstructor", "scriptable", "gc"]
|
||||
* @annotation ["deconstructor"]
|
||||
* @param {bitmap_t*} bitmap bitmap对象。
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
|
@ -20,16 +20,16 @@ TEST(ImageManager, basic) {
|
||||
TEST(ImageManager, allloc) {
|
||||
bitmap_t* bmp = bitmap_create();
|
||||
ASSERT_EQ(image_manager_get_bitmap(image_manager(), "checked", bmp), RET_OK);
|
||||
bitmap_destroy(bmp);
|
||||
bitmap_destroy_with_self(bmp);
|
||||
|
||||
bmp = bitmap_create();
|
||||
ASSERT_EQ(image_manager_lookup(image_manager(), "checked", bmp), RET_OK);
|
||||
ASSERT_EQ(image_manager_get_bitmap(image_manager(), "not found", bmp), RET_NOT_FOUND);
|
||||
bitmap_destroy(bmp);
|
||||
bitmap_destroy_with_self(bmp);
|
||||
|
||||
bmp = bitmap_create();
|
||||
ASSERT_EQ(image_manager_lookup(image_manager(), "unchecked", bmp), RET_NOT_FOUND);
|
||||
bitmap_destroy(bmp);
|
||||
bitmap_destroy_with_self(bmp);
|
||||
|
||||
ASSERT_EQ(image_manager_unload_unused(image_manager(), 0), RET_OK);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ TEST(TabButton, change_value) {
|
||||
ASSERT_EQ(value_bool(&(evt.old_value)), FALSE);
|
||||
ASSERT_EQ(value_bool(&(evt.new_value)), TRUE);
|
||||
|
||||
widget_destroy(w);
|
||||
widget_destroy(g);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
@ -94,6 +94,6 @@ TEST(TabButton, change_value_abort) {
|
||||
ASSERT_EQ(widget_set_prop_bool(w, WIDGET_PROP_VALUE, TRUE), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop_bool(w, WIDGET_PROP_VALUE, TRUE), FALSE);
|
||||
|
||||
widget_destroy(w);
|
||||
widget_destroy(g);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user