Fixed BaseObj finalizer and destroy()

Bug: 28242626
Bug: 27972184
Bug: 27973681

This is resolving issues in ScriptGroup (V1) again.
In ScriptGroup.destroy(), we also need to consider the old API where
mClosures is not initialized.

Also cleaned up the finalizer for ScriptGroup and Allocation:
Since BaseObj.finalize() calls BaseObj.helpDestroy(), instead of
BaseObj.destroy(), there is no possibility that the finalizers of
child objects may race their parents finalizers. Note that
helpDestroy() does not try to recurse on child objects.

Change-Id: I9dbb2b60f8478f656f8a418c2b5fc8d6848aeef0
2 files changed