Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
81291381
Commit
81291381
authored
11 years ago
by
Richard Linden
Browse files
Options
Downloads
Patches
Plain Diff
SH-4080 WIP interesting: random crash on Mac
fixed Mac crash related to non-reentrant singleton constructor
parent
1a01542e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/llsingleton.h
+8
-1
8 additions, 1 deletion
indra/llcommon/llsingleton.h
with
8 additions
and
1 deletion
indra/llcommon/llsingleton.h
+
8
−
1
View file @
81291381
...
@@ -83,8 +83,10 @@ class LLSingleton : private boost::noncopyable
...
@@ -83,8 +83,10 @@ class LLSingleton : private boost::noncopyable
void
construct
()
void
construct
()
{
{
sReentrantConstructorGuard
=
true
;
mSingletonInstance
=
new
DERIVED_TYPE
();
mSingletonInstance
=
new
DERIVED_TYPE
();
mInitState
=
INITIALIZING
;
mInitState
=
INITIALIZING
;
sReentrantConstructorGuard
=
false
;
}
}
~
SingletonInstanceData
()
~
SingletonInstanceData
()
...
@@ -174,7 +176,7 @@ class LLSingleton : private boost::noncopyable
...
@@ -174,7 +176,7 @@ class LLSingleton : private boost::noncopyable
// Use this to avoid accessing singletons before the can safely be constructed
// Use this to avoid accessing singletons before the can safely be constructed
static
bool
instanceExists
()
static
bool
instanceExists
()
{
{
return
getSingletonData
().
mInitState
==
INITIALIZED
;
return
sReentrantConstructorGuard
||
getSingletonData
().
mInitState
==
INITIALIZED
;
}
}
// Has this singleton already been deleted?
// Has this singleton already been deleted?
...
@@ -194,6 +196,11 @@ class LLSingleton : private boost::noncopyable
...
@@ -194,6 +196,11 @@ class LLSingleton : private boost::noncopyable
}
}
virtual
void
initSingleton
()
{}
virtual
void
initSingleton
()
{}
static
bool
sReentrantConstructorGuard
;
};
};
template
<
typename
T
>
bool
LLSingleton
<
T
>::
sReentrantConstructorGuard
=
false
;
#endif
#endif
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