diff options
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp index a2d7a32cb..3daae3deb 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -102,6 +102,7 @@ SPDocument::SPDocument() : root(nullptr), style_cascade(cr_cascade_new(nullptr, nullptr, nullptr)), style_sheet(nullptr), + ref_count(0), uri(nullptr), base(nullptr), name(nullptr), @@ -594,12 +595,19 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un SPDocument *SPDocument::doRef() { + ++ref_count; + // std::cout << "SPDocument::doRef() " << ref_count << " " << this << std::endl; Inkscape::GC::anchor(this); return this; } SPDocument *SPDocument::doUnref() { + --ref_count; + if (ref_count < 0) { + std::cerr << "SPDocument::doUnref(): invalid ref count! " << ref_count << std::endl; + } + // std::cout << "SPDocument::doUnref() " << ref_count << " " << this << std::endl; Inkscape::GC::release(this); return nullptr; } |
