Inkscape
Vector Graphics Editor
|
A base class for anchored objects. More...
#include <gc-anchored.h>
Classes | |
struct | Anchor |
Public Member Functions | |
void | anchor () const |
void | release () const |
unsigned | _anchored_refcount () const |
Anchored (Anchored const &)=delete | |
void | operator= (Anchored const &)=delete |
Protected Member Functions | |
Anchored () | |
virtual | ~Anchored ()=default |
Private Member Functions | |
Anchor * | _new_anchor () const |
void | _free_anchor (Anchor *anchor) const |
Private Attributes | |
Anchor * | _anchor |
A base class for anchored objects.
Objects are managed by our mark-and-sweep collector, but are anchored against garbage collection so long as their reference count is nonzero.
Object and member destructors will not be called on destruction unless a subclass also inherits from Inkscape::GC::Finalized.
New instances of anchored objects should be created using the C++ new operator. Under normal circumstances they should not be created on the stack.
A newly created anchored object begins with a refcount of one, and will not be collected unless the refcount is zero.
NOTE: If you create an object yourself, it is already anchored for you. You do not need to anchor it a second time.
Note that a cycle involving an anchored object (with nonzero refcount) cannot be collected. To avoid this, don't increment refcounts for pointers between two GC-managed objects.
Definition at line 46 of file gc-anchored.h.
|
delete |
|
inlineprotected |
Definition at line 60 of file gc-anchored.h.
References anchor().
|
protectedvirtualdefault |
|
inline |
Definition at line 52 of file gc-anchored.h.
References _anchor, and Inkscape::GC::Anchored::Anchor::refcount.
Referenced by SPObject::releaseReferences().
|
private |
|
private |
Definition at line 57 of file gc-anchored.cpp.
Referenced by anchor().
void Inkscape::GC::Anchored::anchor | ( | ) | const |
Definition at line 65 of file gc-anchored.cpp.
References _anchor, _new_anchor(), and Inkscape::GC::Anchored::Anchor::refcount.
Referenced by _free_anchor(), Inkscape::GC::anchor(), Inkscape::GC::anchor(), and Anchored().
|
delete |
void Inkscape::GC::Anchored::release | ( | ) | const |
Definition at line 73 of file gc-anchored.cpp.
References _anchor, _free_anchor(), and Inkscape::GC::Anchored::Anchor::refcount.
Referenced by Inkscape::XML::SimpleNode::mergeFrom(), SPDocument::rebase(), Inkscape::GC::release(), Inkscape::GC::release(), remove_marker_auto_start_reverse(), remove_marker_context_paint(), and Inkscape::XML::SimpleNode::SimpleNode().
|
mutableprivate |
Definition at line 73 of file gc-anchored.h.
Referenced by _anchored_refcount(), anchor(), and release().