Try this script:
This is the result on console:
Obviously this should not happen. It is possible that this bug is causing a crash (because Tk_BindEvent will be called with invalid data from free'd blocks). In revised version this problem is eliminated.