Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
statics.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#include "statics.h"
3
4#include <cassert>
5
6namespace Inkscape::Util {
7
9{
10 static StaticsBin instance;
11 return instance;
12}
13
15{
16 for (auto n = head; n; n = n->next) {
17 n->destroy();
18 }
19}
20
22{
23 for (auto n = head; n; n = n->next) {
24 // If this assertion triggers, then destroy() wasn't called close enough to the end of main().
25 assert(!n->active() && "StaticsBin::destroy() must be called before main() exit");
26 }
27}
28
32
34 : next{bin.head}
35{
36 bin.head = this;
37}
38
39} // namespace Inkscape::Util
The following system provides a way of dealing with statics/singletons with unusual lifetime requirem...
Definition statics.h:61
static StaticsBin & get()
Definition statics.cpp:8
StaticHolderBase * head
Definition statics.h:70
Miscellaneous supporting code.
Definition document.h:93
Static objects with destruction before main() exit.
UI::Widget::Bin bin