Hold a lock while modifying viewgroups to prevent crashing from asynchronous input