Skip to content

Commit 65ca12b

Browse files
committed
fix move assignment /copy constructor
1 parent bc6b743 commit 65ca12b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,26 @@ namespace client
9999
return *this;
100100
}
101101

102-
AwsSmithyClientT (AwsSmithyClientT&&) = default;
102+
AwsSmithyClientT (AwsSmithyClientT&& other) {
103+
//reference can't be moved, so it gets copied first since moving base class member using the reference will cause crash
104+
m_clientConfiguration = other.m_clientConfiguration;
105+
AwsSmithyClientBase::operator=(std::move(other));
106+
//move other base class members
107+
m_endpointProvider = std::move(other.m_endpointProvider);
108+
m_authSchemeResolver = std::move(other.m_authSchemeResolver);
109+
m_authSchemes = std::move(other.m_authSchemes);
110+
m_serializer = std::move(other.m_serializer);
111+
m_errorMarshaller = std::move(other.m_errorMarshaller);
112+
}
103113

104114
AwsSmithyClientT& operator=(AwsSmithyClientT&& other) {
105115
if(this == &other) {
106116
return *this;
107117
}
108-
m_clientConfiguration = std::move(other.m_clientConfiguration);
118+
//reference can't be moved, so it gets copied first since moving base class member using the reference will cause crash
119+
m_clientConfiguration = other.m_clientConfiguration;
120+
AwsSmithyClientBase::operator=(std::move(other));
121+
//move other base class members
109122
m_endpointProvider = std::move(other.m_endpointProvider);
110123
m_authSchemeResolver = std::move(other.m_authSchemeResolver);
111124
m_authSchemes = std::move(other.m_authSchemes);

0 commit comments

Comments
 (0)