void Pixmap::reference(const Pixmap& p_pixmap) { unreference(); _pp=p_pixmap._pp; if (_pp) { _pp->refcount++; } }
bool Reference::init_ref() { if (reference()) { // this may fail in the scenario of two threads assigning the pointer for the FIRST TIME // at the same time, which is never likely to happen (would be crazy to do) // so don't do it. if (refcount_init.get() > 0) { refcount_init.unref(); unreference(); // first referencing is already 1, so compensate for the ref above } return true; } else { return false; } }
Pixmap::~Pixmap() { unreference(); }