Project: Eclipse_Platform_UI
Bug 264574 ContributedPartFactory: the part created is garbage collected
Reported: 2009-02-11 14:16:35 | Status: resolved fixed

ContributedPartFactory#createWidget(). Notice this code: Object newPart = contributionFactory.create(...); ContextInjectionFactory.inject(newPart, localContext); and then the newPart goes out of scope and gets garbage collected. This used to work as injection maintained a reference both to context and to the newPart. That reference has been replaced by WeakReference and now on my computer Location gets GC when photo demo starts. (Same applies to all other pieces - Preview, Thumbnails, and so on. I left references to methods/fields in the injection code for now but once I replace those with WeakReferences, as we should, all those parts are going to get GCed too.)

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/renderers/swt/ContributedPartFactory.java