Nanotracer: Add copy for object token

Change-Id: I8d11284db1b38eeff6f271495f3095b49415f78c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Marco Bubke
2023-10-16 00:49:14 +02:00
committed by Tim Jenssen
parent b6f14a5421
commit 4aa7c89aad

View File

@@ -421,9 +421,25 @@ public:
ObjectToken() = default; ObjectToken() = default;
ObjectToken(const ObjectToken &other) = delete; ObjectToken(const ObjectToken &other)
: m_name{other.m_name}
, m_category{other.m_category}
{
if (other.m_id)
m_id = m_category->beginObject(m_name).m_id;
}
ObjectToken &operator=(const ObjectToken &other) = delete; ObjectToken &operator=(const ObjectToken &other)
{
if (this != &other) {
~ObjectToken();
if (other.m_id) {
m_category = other.m_category;
m_name = other.m_name;
m_id = other.m_category->beginObject(other.m_name).m_id;
}
}
}
ObjectToken(ObjectToken &&other) noexcept ObjectToken(ObjectToken &&other) noexcept
: m_name{std::move(other.m_name)} : m_name{std::move(other.m_name)}