Fixing unspecified evaluation order of std:move(), to avoid future issues.
This will be done by splitting the use of variables values prior to performing std:move
Bug: webrtc:15771
Change-Id: Ia88e733c3a4edf729e440295ae271d3cd9926ec5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334461
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41532}
diff --git a/net/dcsctp/tx/rr_send_queue.cc b/net/dcsctp/tx/rr_send_queue.cc
index 7cbead2..3e682fd 100644
--- a/net/dcsctp/tx/rr_send_queue.cc
+++ b/net/dcsctp/tx/rr_send_queue.cc
@@ -373,8 +373,9 @@
: Timestamp::PlusInfinity(),
.lifecycle_id = send_options.lifecycle_id,
};
- GetOrCreateStreamInfo(message.stream_id())
- .Add(std::move(message), std::move(attributes));
+ StreamID stream_id = message.stream_id();
+ GetOrCreateStreamInfo(stream_id).Add(std::move(message),
+ std::move(attributes));
RTC_DCHECK(IsConsistent());
}
diff --git a/p2p/base/stun_dictionary.cc b/p2p/base/stun_dictionary.cc
index 318bed0..aabb8c3 100644
--- a/p2p/base/stun_dictionary.cc
+++ b/p2p/base/stun_dictionary.cc
@@ -214,7 +214,8 @@
if (attr->value_type() == STUN_VALUE_BYTE_STRING && attr->length() == 0) {
attrs_.erase(attr->type());
} else {
- attrs_[attr->type()] = std::move(attr);
+ int attribute_type = attr->type();
+ attrs_[attribute_type] = std::move(attr);
}
}
}
diff --git a/pc/test/svc_e2e_tests.cc b/pc/test/svc_e2e_tests.cc
index 3fde5a4..3501b64 100644
--- a/pc/test/svc_e2e_tests.cc
+++ b/pc/test/svc_e2e_tests.cc
@@ -336,10 +336,9 @@
RtpEncodingParameters parameters;
parameters.scalability_mode = SvcTestParameters().scalability_mode;
video.encoding_params.push_back(parameters);
- alice->AddVideoConfig(
- std::move(video),
- CreateScreenShareFrameGenerator(
- video, ScreenShareConfig(TimeDelta::Seconds(5))));
+ auto generator = CreateScreenShareFrameGenerator(
+ video, ScreenShareConfig(TimeDelta::Seconds(5)));
+ alice->AddVideoConfig(std::move(video), std::move(generator));
alice->SetVideoCodecs({video_codec_config});
},
[](PeerConfigurer* bob) {}, std::move(analyzer));