- Delete previous Layout before creating next one, and in destructor - Use stack XKBContext instead of local new+delete - Lock mutex in update() as it is called from a different thread than onEvent(res)