summaryrefslogtreecommitdiff
path: root/include/utils/RefBase.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/utils/RefBase.h')
-rw-r--r--include/utils/RefBase.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index 9b0e7d8a44..f355087713 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -425,8 +425,11 @@ void wp<T>::set_object_and_refs(T* other, weakref_type* refs)
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>