Code

Use subdirectories with icon sizes.
[inkscape.git] / src / gc-anchored.h
index f9d609074e3a56d13640cc2638c1b9b141272655..b15d11f5d0e31deb0952abaccf0b09f928f0330e 100644 (file)
@@ -3,8 +3,7 @@
  *
  * Authors:
  *   MenTaLguY <mental@rydia.net>
- *
- * Copyright (C) 2004 MenTaLguY
+ * * Copyright (C) 2004 MenTaLguY
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
@@ -40,7 +39,7 @@ namespace GC {
  *
  * 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
@@ -50,22 +49,17 @@ namespace GC {
 
 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> {
@@ -182,4 +176,4 @@ static R *release(R *r) {
   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 :