try to avoid crashes due to race conditions with GL thread