Add function to be called from DestroyObject hook.

Fix whitespace.