m_refcount was an integer with the refcount so yes that should do it. btw you could consider keeping the refcount as part of the object (not a pointer).