Project: Eclipse_Platform_UI
Bug 226217 [Perspectives] [ViewMgmt] createView called without corresponding releaseView
Reported: 2008-04-08 21:19:04 | Status: verified fixed

I chasing down a bug where a viewReference is being created but not released. Unfortunately, I can't easily produce using simple Eclipse. The basic steps are: 1. RestoreState where there are several perspectives represented as tabs. Each of the views has a counter associated with it set to 1. 2. Close the tab without opening the perspective. The problem is releaseView is not called due to this code in Perspective.java. public void dispose() { if (presentation == null) { return; } 3. Now open the perspective. The counter associate with the views are off by 1. ----- I modified ViewFactor.java as follows ViewFactory.java public void releaseView(IViewReference viewRef) { String key = getKey(viewRef); IViewReference ref = (IViewReference) counter.get(key); if (ref == null) { return; } System.out.println("ReleaseView = " + viewRef.getId() + " " + counter.getRef(key)); //$NON-NLS-1$ //$NON-NLS-2$ ... } public IViewReference createView(String id, String secondaryId) throws PartInitException { .... System.out.println("CreateView = " + ref.getId() + " " + counter.getRef(key)); //$NON-NLS-1$ //$NON-NLS-2$ return ref; } And got the following results: **** RestoringState CreateView = com.ibm.workplace.noteswc.views.NotesHomepage 1 CreateView = com.ibm.rcp.gettingstarted.GettingstartView 1 CreateView = com.ibm.rcp.csiviews.viewpart.CSINavViewPart 1 CreateView = com.ibm.rcp.csiviews.viewpart.CSIViewPart 1 CreateView = com.ibm.workplace.noteswc.views.NotesViewData 1 **** Closing the tab <nothing> **** Opening the Perspective (notice the count) CreateView = com.ibm.rcp.csiviews.viewpart.CSINavViewPart 2 CreateView = com.ibm.rcp.csiviews.viewpart.CSIViewPart 2 CreateView = com.ibm.workplace.noteswc.views.NotesViewData 2

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java