Skip to content

Commit

Permalink
fix: free styles on component deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
EmixamPP committed Aug 26, 2024
1 parent 2eef040 commit 1b094ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/render/native/core/basic/comp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void BasicComponent::setTransition (JSContext* ctx, JSValue obj, lv_style_t* sty
lv_style_prop_t* old_transProps = this->trans_props_map[type];

this->trans_props_map[type] = (lv_style_prop_t*)malloc((len + 1) * sizeof(lv_style_prop_t));

JSValue props = JS_GetPropertyUint32(ctx, obj, 1);
int32_t prop_key;
for(int i=0; i < len; i++) {
Expand Down Expand Up @@ -255,6 +255,11 @@ BasicComponent::~BasicComponent () {
if (ptr2) {
free((lv_coord_t*)(ptr2));
}

for(auto &style : style_map) {
lv_style_reset(style.second);
}

// do not del here, remove child will do the action
// lv_obj_del(this->instance);
};
Expand Down

0 comments on commit 1b094ba

Please sign in to comment.