diff --git a/native/cocos/bindings/manual/jsb_scene_manual_ext.cpp b/native/cocos/bindings/manual/jsb_scene_manual_ext.cpp index 3c49bad24a..a5c8a2aa3d 100644 --- a/native/cocos/bindings/manual/jsb_scene_manual_ext.cpp +++ b/native/cocos/bindings/manual/jsb_scene_manual_ext.cpp @@ -1,5 +1,7 @@ #include "bindings/auto/jsb_scene_auto.h" +#include "bindings/event/CustomEventTypes.h" +#include "bindings/event/EventDispatcher.h" #include "jsb_scene_manual.h" #include "scene/Model.h" #include "scene/Node.h" @@ -210,6 +212,10 @@ bool register_all_scene_ext_manual(se::Object *obj) { //NOLINT msgQueue = se::Object::createArrayObject(1); msgQueueInfo = se::Object::createTypedArray(se::Object::TypedArrayType::UINT32, nullptr, sizeof(uint32_t) * 2); + cc::EventDispatcher::addCustomEventListener(EVENT_RESTART_VM, [&](const cc::CustomEvent & /*e*/) { + msgQueuePtrs.clear(); + }); + { uint8_t *data{nullptr}; msgArrayBuffer->getArrayBufferData(&data, nullptr);