fix memory leak when add listener to ui object
Merge pull request #8857 from zhongfq/patch-2

fix memory leak when add listener to ui object