summaryrefslogtreecommitdiffstats
path: root/src/util/statics.cpp
diff options
context:
space:
mode:
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");
+}