From 0e23ff79f1fbb850256534cd61ff66bf5bdff305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:29:59 +0800 Subject: [PATCH] 3.3 fix mq restart (#3805) * fix mq restart --- native/cocos/bindings/manual/jsb_scene_manual_ext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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);