Fix data race in state events

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>