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
6
namespace
Inkscape::Util
{
7
8
StaticsBin
&
StaticsBin::get
()
9
{
10
static
StaticsBin
instance;
11
return
instance;
12
}
13
14
void
StaticsBin::destroy
()
15
{
16
for
(
auto
n =
head
; n; n = n->next) {
17
n->destroy();
18
}
19
}
20
21
StaticsBin::~StaticsBin
()
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
29
StaticHolderBase::StaticHolderBase
()
30
:
StaticHolderBase
(
StaticsBin
::get())
31
{}
32
33
StaticHolderBase::StaticHolderBase
(
StaticsBin
&
bin
)
34
: next{
bin
.head}
35
{
36
bin
.head =
this
;
37
}
38
39
}
// namespace Inkscape::Util
Inkscape::Util::StaticHolderBase
Definition
statics.h:76
Inkscape::Util::StaticHolderBase::StaticHolderBase
StaticHolderBase()
Definition
statics.cpp:29
Inkscape::Util::StaticsBin
The following system provides a way of dealing with statics/singletons with unusual lifetime requirem...
Definition
statics.h:61
Inkscape::Util::StaticsBin::destroy
void destroy()
Definition
statics.cpp:14
Inkscape::Util::StaticsBin::get
static StaticsBin & get()
Definition
statics.cpp:8
Inkscape::Util::StaticsBin::head
StaticHolderBase * head
Definition
statics.h:70
Inkscape::Util::StaticsBin::~StaticsBin
~StaticsBin()
Definition
statics.cpp:21
Inkscape::Util
Miscellaneous supporting code.
Definition
document.h:93
statics.h
Static objects with destruction before main() exit.
bin
UI::Widget::Bin bin
Definition
tracedialog.cpp:99
src
util
statics.cpp
Generated on Sun Jul 6 2025 04:02:07 for Inkscape by
1.9.8