Add lock for _recordChanged variable (#5453)