Skip to content

Commit 6f227cd

Browse files
committed
Fix ErrorStorage initialization of private fields
1 parent 3dc3105 commit 6f227cd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/realm/object-store/c_api/error.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace realm::c_api {
1515
ErrorStorage::ErrorStorage(std::exception_ptr ptr) noexcept
1616
: m_err(none)
1717
, m_message_buf()
18+
, m_usercode_error(nullptr)
19+
1820
{
1921
printf("ErrorStorage::ErrorStorage(std::exception_ptr ptr) noexcept\n");
2022
assign(std::move(ptr));
@@ -23,6 +25,7 @@ ErrorStorage::ErrorStorage(std::exception_ptr ptr) noexcept
2325
ErrorStorage::ErrorStorage(const ErrorStorage& other)
2426
: m_err(other.m_err)
2527
, m_message_buf(other.m_message_buf)
28+
, m_usercode_error(other.m_usercode_error)
2629
{
2730
printf("ErrorStorage::ErrorStorage(const ErrorStorage& other)\n");
2831
if (m_err) {
@@ -35,6 +38,7 @@ ErrorStorage& ErrorStorage::operator=(const ErrorStorage& other)
3538
printf("ErrorStorage& ErrorStorage::operator=(const ErrorStorage& other)\n");
3639
m_err = other.m_err;
3740
m_message_buf = other.m_message_buf;
41+
m_usercode_error = other.m_usercode_error;
3842
if (m_err) {
3943
m_err->message = m_message_buf.c_str();
4044
}
@@ -44,6 +48,7 @@ ErrorStorage& ErrorStorage::operator=(const ErrorStorage& other)
4448
ErrorStorage::ErrorStorage(ErrorStorage&& other)
4549
: m_err(std::move(other.m_err))
4650
, m_message_buf(std::move(other.m_message_buf))
51+
, m_usercode_error(std::move(other.m_usercode_error))
4752
{
4853
printf("ErrorStorage::ErrorStorage(ErrorStorage&& other)\n");
4954
if (m_err) {
@@ -57,6 +62,7 @@ ErrorStorage& ErrorStorage::operator=(ErrorStorage&& other)
5762
printf("ErrorStorage& ErrorStorage::operator=(ErrorStorage&& other)\n");
5863
m_err = std::move(other.m_err);
5964
m_message_buf = std::move(other.m_message_buf);
65+
m_usercode_error = std::move(other.m_usercode_error);
6066
if (m_err) {
6167
m_err->message = m_message_buf.c_str();
6268
}
@@ -72,7 +78,7 @@ bool ErrorStorage::operator==(const ErrorStorage& other) const noexcept
7278
else if (!m_err && !other.m_err) {
7379
return true;
7480
}
75-
return m_err->error == other.m_err->error && m_message_buf == other.m_message_buf;
81+
return m_err->error == other.m_err->error && m_message_buf == other.m_message_buf; // && m_usercode_error == other.m_usercode_error; //TODO: should we compare the usercode_error here
7682
}
7783

7884
void ErrorStorage::assign(std::exception_ptr eptr) noexcept

0 commit comments

Comments
 (0)