Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
2ae5d3f3
Commit
2ae5d3f3
authored
10 years ago
by
ShadowNinja
Browse files
Options
Downloads
Patches
Plain Diff
Fix Settings locking
parent
cd64a92a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/settings.h
+19
-13
19 additions, 13 deletions
src/settings.h
with
19 additions
and
13 deletions
src/settings.h
+
19
−
13
View file @
2ae5d3f3
...
...
@@ -741,9 +741,7 @@ class Settings
void
clear
()
{
JMutexAutoLock
lock
(
m_mutex
);
m_settings
.
clear
();
m_defaults
.
clear
();
clearNoLock
();
}
void
updateValue
(
const
Settings
&
other
,
const
std
::
string
&
name
)
...
...
@@ -758,8 +756,6 @@ class Settings
m_settings
[
name
]
=
val
;
}
catch
(
SettingNotFoundException
&
e
)
{
}
return
;
}
void
update
(
const
Settings
&
other
)
...
...
@@ -770,17 +766,14 @@ class Settings
JMutexAutoLock
lock
(
m_mutex
);
JMutexAutoLock
lock2
(
other
.
m_mutex
);
m_settings
.
insert
(
other
.
m_settings
.
begin
(),
other
.
m_settings
.
end
());
m_defaults
.
insert
(
other
.
m_defaults
.
begin
(),
other
.
m_defaults
.
end
());
return
;
updateNoLock
(
other
);
}
Settings
&
operator
+=
(
const
Settings
&
other
)
{
update
(
other
);
return
*
this
;
return
*
this
;
}
Settings
&
operator
=
(
const
Settings
&
other
)
...
...
@@ -791,14 +784,27 @@ class Settings
JMutexAutoLock
lock
(
m_mutex
);
JMutexAutoLock
lock2
(
other
.
m_mutex
);
clear
();
update
(
other
);
clearNoLock
();
updateNoLock
(
other
);
return
*
this
;
}
private
:
void
updateNoLock
(
const
Settings
&
other
)
{
m_settings
.
insert
(
other
.
m_settings
.
begin
(),
other
.
m_settings
.
end
());
m_defaults
.
insert
(
other
.
m_defaults
.
begin
(),
other
.
m_defaults
.
end
());
}
void
clearNoLock
()
{
m_settings
.
clear
();
m_defaults
.
clear
();
}
std
::
map
<
std
::
string
,
std
::
string
>
m_settings
;
std
::
map
<
std
::
string
,
std
::
string
>
m_defaults
;
// All methods that access m_settings/m_defaults directly should lock this.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment