Skip to content

Commit

Permalink
fix wrong double-checked locking
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T authored and jukzi committed Jun 9, 2023
1 parent f3197c1 commit 7280baa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ public static BaseHelpSystem getInstance() {
* help system's search capability.
*/
public static SearchManager getSearchManager() {
if (getInstance().searchManager == null) {
synchronized (BaseHelpSystem.class) {
if (getInstance().searchManager == null) {
getInstance().searchManager = new SearchManager();
}
synchronized (BaseHelpSystem.class) {
if (getInstance().searchManager == null) {
getInstance().searchManager = new SearchManager();
}
}
return getInstance().searchManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ public static HelpPlugin getDefault() {
* @return instance of TocManager
*/
public static TocManager getTocManager() {
if (getDefault().tocManager == null) {
synchronized (tocManagerCreateLock) {
if (getDefault().tocManager == null) {
getDefault().tocManager = new TocManager();
}
synchronized (tocManagerCreateLock) {
if (getDefault().tocManager == null) {
getDefault().tocManager = new TocManager();
}
}
return getDefault().tocManager;
Expand Down

0 comments on commit 7280baa

Please sign in to comment.