cierpuchaw added inline comments.
================
Comment at: clangd/DocumentStore.h:42
/// Delete a document from the store.
- void removeDocument(StringRef Uri) { Docs.erase(Uri); }
+ void removeDocument(StringRef Uri) { Docs.erase(Uri);
+ for (const auto &Listener : Listeners)
----------------
bkramer wrote:
> klimek wrote:
> > krasimir wrote:
> > > cierpuchaw wrote:
> > > > cierpuchaw wrote:
> > > > > Shouldn't this be called under a lock_guard?
> > > > I should've reworded my comment before submitting it. By 'this' I'm
> > > > referring to the 'Docs.erase()' part, not the whole function.
> > > >
> > > Even under a guard, it may potentially still be unsafe since workers may
> > > operate on erased/modified StringRef-s.
> > That depends on the guarantees made, and when we create copies :)
> Added guard.
'Docs.erase(Uri);' is still outside the critical section. It's easy to miss
because of its placement directly after '{'.
https://reviews.llvm.org/D29886
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits