rework synchronization with renderer thread to fix intermittent crashes