From 32a55cf66e12e5e56d2e05b73c6bef453477c2bb Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 25 Feb 2011 16:11:44 -0800 Subject: Fix sp<> conversion operator / constructor some of the conversion operators were not using the proper pointer type when calling incStrong/decStrong, usually it has no bad consequences, but for some implementation of the ref-counted object it could lead to recording the wrong owner id. Change-Id: If574b9069b8a4cf6e0911a992c8f095aba799995 --- include/utils/StrongPointer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/utils') diff --git a/include/utils/StrongPointer.h b/include/utils/StrongPointer.h index a8c9897..49fa3a8 100644 --- a/include/utils/StrongPointer.h +++ b/include/utils/StrongPointer.h @@ -133,7 +133,7 @@ sp::sp(const sp& other) template template sp::sp(U* other) : m_ptr(other) { - if (other) other->incStrong(this); + if (other) ((T*)other)->incStrong(this); } template template @@ -170,7 +170,7 @@ sp& sp::operator = (T* other) template template sp& sp::operator = (const sp& other) { - U* otherPtr(other.m_ptr); + T* otherPtr(other.m_ptr); if (otherPtr) otherPtr->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = otherPtr; @@ -180,7 +180,7 @@ sp& sp::operator = (const sp& other) template template sp& sp::operator = (U* other) { - if (other) other->incStrong(this); + if (other) ((T*)other)->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = other; return *this; -- cgit v1.1