EXC_BAD_ACCESS: Game crashes when touching sprites at the time when garbage collection is triggered by cocos2dx (iOS only)

There’s an issue with EventManager that causes the game to crash on iOS devices. It works fine on Android. I am using cocos2d-x 3.17 with TypeScript / Javascript.

I have abstracted out the code for adding event listeners to a node in a separate utility called TouchHelper, which can be found here: cocos2dx-TouchHelper · GitHub

Details about the issue:
There are lots of ‘basic_object_finalize’ messages in the logs, which indicates that some sort of garbage collection was triggered. (Those messages occur from garbage collecting a couple of XMLHttpRequest objects.) If I am touching and interacting with any object during this process, the crash occurs, and the breakpoint occurs at handling onTouchMoved event. I am unable to determine which node it belongs to from the debugger. If I am not touching the screen, it works fine.

I have tried a lot of things, but haven’t been able to fix the issue. Can anyone give me any pointers about this?

Fix will be available in next(3.17.1) release.
https://github.com/cocos2d/cocos2d-x/pull/19191