Fix a crash while accessing shape's RTTI info during its destruction
Thanks TestSvgParser unittest for pointing out this problem. In real life it happened randomly without any easy way to reproduce.