| Summary: | Editor caches external file changes | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Technology] DLTK | Reporter: | Wojciech Galanciak <wojciech.galanciak> | ||||||
| Component: | Common | Assignee: | dltk.common-inbox <dltk.common-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | alex.panchenko, ganoro | ||||||
| Version: | 4.0 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Wojciech Galanciak
Created attachment 208933 [details]
patch
The problem is located in org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider. It is possible that when SourceModuleDocumentProvider.connect(Object) is called a new file info is added with a fake source module (line 1281 in SourceModuleDocumentProvider.createFileInfo(Object)) but it is not added to fFakeCUMapForMissingInfo map. During fake source module creation new buffer is created for it (org.eclipse.dltk.internal.ui.editor.DocumentAdapter). During its initialization (DocumentAdapter.initialize()) fFile is null so fileStore is stored in TextFileBufferManager (IFileBufferManager.connectFileStore(IFileStore, IProgressMonitor)).
When file is closed fake copy is disconnected but only if file info is stored in fFakeCUMapForMissingInfo (in our case it does not). The second problem is in DocumentAdapter.close() method. It only disconnect buffer but does not disconnect fileStore (in our case only file store was connected).
The result is that fileStore is not fully disconnected and when the file is opened again then modification are restored from it.
I was able to reproduce the bug. Checking the patch. Created attachment 208985 [details] patch2 The fixes continue the changes started by bugĀ 267008 "No validation for opened external files in PDT" (btw, how to check if it works?) There were 2 calls to create working copy, so now you need 2 calls to discard it. It doesn't feel correct, let's try if it can work with only 1 call. Please try how it works with my patch. Editor content is not cached, but I have no idea how to check the behavior of the mentioned bug 267008, even with PDT sources. Your fix breaks bug 267008. To check it you need to break a code (e.g. line "echo 'hello world';" change to "echoo 'hello world';"). Finally, it looks like your patch does not affect on bug 267008 so it can be committed. Patch2 committed. |