summaryrefslogtreecommitdiffstats
path: root/src/util/statics.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:50:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:50:49 +0000
commitc853ffb5b2f75f5a889ed2e3ef89b818a736e87a (patch)
tree7d13a0883bb7936b84d6ecdd7bc332b41ed04bee /src/util/statics.cpp
parentInitial commit. (diff)
downloadinkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.tar.xz
inkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.zip
Adding upstream version 1.3+ds.upstream/1.3+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/util/statics.cpp')
-rw-r--r--src/util/statics.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/statics.cpp b/src/util/statics.cpp
new file mode 100644
index 0000000..66add67
--- /dev/null
+++ b/src/util/statics.cpp
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#include "statics.h"
+
+Inkscape::Util::StaticsBin &Inkscape::Util::StaticsBin::get()
+{
+ static StaticsBin instance;
+ return instance;
+}
+
+void Inkscape::Util::StaticsBin::destroy()
+{
+ while (head) {
+ head->destroy();
+ head = head->next;
+ }
+}
+
+Inkscape::Util::StaticsBin::~StaticsBin()
+{
+ // If this assertion triggers, then destroy() wasn't called close enough to the end of main().
+ assert(!head && "StaticsBin::destroy() must be called before main() exit");
+}