Protecting access to pluginLocations global variable through mutex.
Refactoring code introduced in commit
76648c62f56e4acb6ad0ad97cf84fb4df76cf73c.

Now the code has a clearer intention.