针对 Pomelo.as 内 onData 事件对 _pkg 清理时机不当的问题,做了少量调整 #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在 Pomelo.as 内,经处理获取 _pkg.body 后,会进入 swith (_pkg.type) 进行各种判断和处理。但 _pkg = null 的时机,有几个在 dispatchEvent 及 callback.call 之后。
如果外界的事件处理或回调处理过程中出现错误,则在 dispatchEvent 或 callback.call 之后的代码都不会被执行,包括 _pkg = null。
所以我将 _pkg 的清理时机提前,在用完它之后马上清除;并将清除代码多写了几行,以策内存安全。