Community
Participate
Working Groups
Build ID: M20071023-1652 Steps To Reproduce: 1. Call mergeInto on a NavigationHistoryEntry with a NavigationLocation set using a NavigationHistoryEntry as param which has no location (location == null). 2. Call dispose on the same NavigationHistoryEntry. The NavigationLocation is disposed, but shouldn't. It happens in our editor, when eclipse starts while it was previously open. More information: /** * Disposes this entry and its location. */ void dispose() { if (location != null) { location.dispose(); } editorInfo = null; } /** * Merges this entry into the current entry. Returns true * if the merge was possible otherwise returns false. */ boolean mergeInto(NavigationHistoryEntry currentEntry) { if (editorInfo.editorInput != null && editorInfo.editorInput .equals(currentEntry.editorInfo.editorInput)) { if (location != null) { if (currentEntry.location == null) { currentEntry.location = location; //location is used by both entries, but will be disposed with the first entry return true; } else { return location.mergeInto(currentEntry.location); } } else if (currentEntry.location == null) { return true; } } return false; }
Do you have a suggestion as how to fix this?
What about if currentEntry.location == null first create a new Location and then call location.mergeInto(currentEntry.location); Later, PW
I think creating a new location as suggested in #2 would be the best solution. Another possibility is to set the this.location = null. if (currentEntry.location == null) { currentEntry.location = location; location = null; return true; } else { This would imply that the entry on which mergedInto was called won't be used after. I wonder how it comes that there is an entry without a location, i thought that the location should always be restored by a call to #restoreLocation before it is merged.
Fixed in HEAD by setting this.location to null.
Heiko, could you verify (using a recent I build) that my fix works for you?
Verified by code inspection in I20080502-0100.