Make QSResourceManager thread safe

Fixes #1861

See #1861 for most of the discussion. This pull request won't necessarily 'fix all out problems', since there are probably still plugins that call `[NSImage imageNamed:]`, whereas they should call `[QSResourceManager imageNamed:]`