Fixes #199 ('"Missing/misused m_is_wide in char_wchar_holder assignment operators").

This commit is contained in:
Ion Gaztañaga
2024-09-26 23:47:36 +02:00
parent a22d4986d7
commit 6c8f351fda
2 changed files with 8 additions and 3 deletions

View File

@@ -6778,8 +6778,11 @@ thank them:
You can obtain the pre-Boost 1.87 ABI #defining `BOOST_INTERPROCESS_SEGMENT_MANAGER_ABI` to `1` before including Boost.Interprocess headers.
* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/210 GitHub #210 (['"Bug in boost::interprocess::ipcdetail::sync_handles::obtain_mutex"])].
* [@https://github.com/boostorg/interprocess/issues/192 GitHub #192 (['"managed_windows_shared_memory crash on destruction"])].
* [@https://github.com/boostorg/interprocess/issues/199 GitHub #199 (['"missing/misused m_is_wide in char_wchar_holder assignment operators"])].
* [@https://github.com/boostorg/interprocess/issues/210 GitHub #210 (['"Bug in boost::interprocess::ipcdetail::sync_handles::obtain_mutex"])].
* [@https://github.com/boostorg/interprocess/issues/215 GitHub #215 (['"Alignment problem with boost/interprocess/segment_manager on SPARC 32Bit"])].
[endsect]

View File

@@ -57,6 +57,7 @@ class char_wchar_holder
this->delete_mem();
m_str.n = tmp;
std::strcpy(m_str.n, nstr);
m_is_wide = false;
return *this;
}
@@ -66,15 +67,16 @@ class char_wchar_holder
this->delete_mem();
m_str.w = tmp;
std::wcscpy(m_str.w, wstr);
m_is_wide = true;
return *this;
}
char_wchar_holder& operator=(const char_wchar_holder &other)
{
if (other.m_is_wide)
*this = other.getn();
else
*this = other.getw();
else
*this = other.getn();
return *this;
}