Merge "Avoid taking a lock when we shouldn't" into qt-dev