Fixed double calling onExit method.
Little refactor.
Merge pull request #6772 from natural-law/v3

Update the reference of submodule plugin-x.
Merge pull request #6756 from zifter/FixTwiceCallingOnExit

Fix twice calling on exit