Skip to content

Commit

Permalink
fix: remove lvgl event callback on component deletion
Browse files Browse the repository at this point in the history
This cause a segfault
  • Loading branch information
EmixamPP committed Aug 26, 2024
1 parent 1b094ba commit 6be145f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/render/native/components/component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ void NativeComponentMaskInit (JSContext* ctx, JSValue ns);
#define WRAPPED_JS_CLOSE_COMPONENT(COMPONENT,COMPONENT_NAME) \
static JSValue NativeCompCloseComponent(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { \
COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \
lv_obj_del_async(((BasicComponent*)(s->comp))->instance); \
lv_obj_t* instance = ((BasicComponent*)(s->comp))->instance; \
((BasicComponent*)(s->comp))->instance = nullptr; \
lv_obj_remove_event_cb(instance, &BasicComponent::EventCallback); \
lv_obj_del_async(instance); \
return JS_UNDEFINED; \
} \
\
Expand Down

0 comments on commit 6be145f

Please sign in to comment.