fix the way of removeing a mesh
Merge pull request #5002 from gero3/FixMemoryProblem

fix the way of removeing a mesh