Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
a396e891
Commit
a396e891
authored
Aug 09, 2017
by
Ronan
Browse files
fix(Singleton): delete properly instance at program termination
parent
3c446b76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
src/cpim/header/cpim-generic-header.cpp
src/cpim/header/cpim-generic-header.cpp
+2
-2
src/object/singleton.h
src/object/singleton.h
+9
-1
No files found.
src/cpim/header/cpim-generic-header.cpp
View file @
a396e891
...
...
@@ -32,8 +32,8 @@ using namespace LinphonePrivate;
class
Cpim
::
GenericHeaderPrivate
:
public
HeaderPrivate
{
public:
GenericHeaderPrivate
()
:
parameters
(
make_shared
<
list
<
pair
<
string
,
string
>
>
>
())
{
}
GenericHeaderPrivate
()
:
parameters
(
make_shared
<
list
<
pair
<
string
,
string
>
>
>
())
{}
string
name
;
shared_ptr
<
list
<
pair
<
string
,
string
>
>
>
parameters
;
};
...
...
src/object/singleton.h
View file @
a396e891
...
...
@@ -30,8 +30,10 @@ namespace LinphonePrivate {
virtual
~
Singleton
()
=
default
;
static
T
*
getInstance
()
{
if
(
!
mInstance
)
if
(
!
mInstance
)
{
mInstance
=
new
T
();
static
SingletonDeleter
deleter
;
}
return
mInstance
;
}
...
...
@@ -39,6 +41,12 @@ namespace LinphonePrivate {
explicit
Singleton
(
ObjectPrivate
&
p
)
:
Object
(
p
)
{}
private:
struct
SingletonDeleter
{
~
SingletonDeleter
()
{
delete
mInstance
;
}
};
static
T
*
mInstance
;
L_DISABLE_COPY
(
Singleton
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment