[Engine] Applying the dirty flag without holding a lock on the lights