diff --git a/src/gc-anchored.h b/src/gc-anchored.h
index f9d609074e3a56d13640cc2638c1b9b141272655..b15d11f5d0e31deb0952abaccf0b09f928f0330e 100644 (file)
--- a/src/gc-anchored.h
+++ b/src/gc-anchored.h
*
* Authors:
* MenTaLguY <mental@rydia.net>
- *
- * Copyright (C) 2004 MenTaLguY
+ * * Copyright (C) 2004 MenTaLguY
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
*
* 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 garbage-collected objects.
+ * pointers between two GC-managed objects.
*
* @see Inkscape::GC::Managed
* @see Inkscape::GC::Finalized
class Anchored {
public:
- void anchor() const {
- if (!_anchor) {
- _anchor = _new_anchor();
- }
- _anchor->refcount++;
- }
+ void anchor() const;
+ void release() const;
- void release() const {
- if (!--_anchor->refcount) {
- _free_anchor(_anchor);
- _anchor = NULL;
- }
+ // for debugging
+ unsigned _anchored_refcount() const {
+ return ( _anchor ? _anchor->refcount : 0 );
}
protected:
Anchored() : _anchor(NULL) { anchor(); } // initial refcount of one
+ virtual ~Anchored() {}
private:
struct Anchor : public Managed<SCANNED, MANUAL> {
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :