FIX: avoid waiting forever on a locked CPluginDirectory while exiting
Merge pull request #3124 from koying/fixplugingetdirlock

FIX: avoid waiting forever on a locked CPluginDirectory while exiting