add missing properties of cp.SegmentShape and cp.PolyShape

#1048 
I don't know why need an onExit to clean. It's not Javascirpt idiom, if it's needed, it's a BUG.
And I tested, the test will not crash after clicking several times.