Ensure one can call DisposeEnvironment during event callbacks.
am: 6a0e0b242a

Change-Id: I28b0d385ba5e09c339264fa72d45e13f33a5b970