Fix crash in destructor
Merge pull request #1 from agateau/fix-crash-in-dtor

Fix crash in destructor