fix potential crash when user remove self in widgets callback

This PR fix potential crash when user remove widgets in its callbacks.