aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrepojohnray <repojohnray@users.noreply.github.com>2022-07-03 18:45:17 +0200
committerrepojohnray <repojohnray@users.noreply.github.com>2022-07-03 22:08:16 +0200
commite2970c31cf573a0130706e40a2520e3249fa22d0 (patch)
tree5fe77d8a2ef29b6beaaa2499e76b8885ec79319d
parent0070a8e3ca15743974bf28076cd824aa95734495 (diff)
[addons] add CStructHdl operator= support for 'A = A'
This change fixes the issue described here: https://github.com/kodi-pvr/pvr.vdr.vnsi/pull/186
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h b/xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h
index 880b8875ae..a626122042 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h
@@ -133,6 +133,10 @@ public:
const CStructHdl& operator=(const CStructHdl& right)
{
assert(&right.m_cStructure);
+
+ if (this == &right)
+ return *this;
+
if (m_cStructure && !m_owner)
{
memcpy(m_cStructure, right.m_cStructure, sizeof(C_STRUCT));
@@ -150,6 +154,10 @@ public:
const CStructHdl& operator=(const C_STRUCT& right)
{
assert(&right);
+
+ if (m_cStructure == &right)
+ return *this;
+
if (m_cStructure && !m_owner)
{
memcpy(m_cStructure, &right, sizeof(C_STRUCT));