Fix a wp<> bug where the owner ID would be wrong
this was introduced recently. we make sure to use
the correct owner id (the sp) instead of the wp.
Change-Id: I78fdc6ec0c2d3e687278b70442d74d1924b512a2
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index 9b0e7d8..f355087 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -425,8 +425,11 @@
template<typename T>
sp<T> wp<T>::promote() const
{
- T* p = (m_ptr && m_refs->attemptIncStrong(this)) ? m_ptr : 0;
- return sp<T>(p, true);
+ sp<T> result;
+ if (m_ptr && m_refs->attemptIncStrong(&result)) {
+ result.set_pointer(m_ptr);
+ }
+ return result;
}
template<typename T>