| Summary: | Shared ast is exposed for concurrent usage | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Markus Schorn <mschorn.eclipse> |
| Component: | cdt-editor | Assignee: | Anton Leherbauer <aleherb+eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | Anton Leherbauer <aleherb+eclipse> |
| Severity: | major | ||
| Priority: | P3 | CC: | angvoz.dev, cdtdoug, eclipse.sprigogin |
| Version: | 8.0 | Flags: | eclipse.sprigogin:
review+
|
| Target Milestone: | 8.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Previously, the ast was protected by wrapping the runOnAst in a synchronized (ast) block:
synchronized (ast) {
return astRunnable.runOnAST(lang, ast);
}
The same is done in the reconciler calling the IReconcilingListeners:
synchronized (ast) {
((ICReconcilingListener)fEditor).reconciled(ast, forced, fProgressMonitor);
}
Now we have two different methods. ASTCache uses IASTTranslationUnit.beginExclusiveAccess() while the reconciler still uses the old method.
I committed a fix to use begin/endExclusiveAccess also for notifying the listeners. Sergey, could you review? *** cdt cvs genie on behalf of aleherbau *** Bug 343948 - Shared ast is exposed for concurrent usage [*] CReconcilingStrategy.java 1.28 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java?root=Tools_Project&r1=1.27&r2=1.28 (In reply to comment #2) The fix looks good. Thanks for fixing this. *** Bug 343175 has been marked as a duplicate of this bug. *** |
The shared ast is exposed to the ASTProvider before the reconciler is done. To reproduce set a breakpoints: * Set a breakpoint in CEditor.reconciled(..) in the line where the listeners are notified. * Make a change to the file in the editor and wait until the breakpoint is hit. * Set another breakpoint in ASTCache.runOnAST(...) * Select a name in the editor and select F3. --> The second breakpoint is hit in a different thread with access to the same ast.