Bug 337002 EPartService leaks previously active part
A reference is kept to the previously active part. This is unnecessary. We only need it to fire events. After the deactivation events have been fired, we should no longer need to keep it lying around.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
perspectiveB1.setSelectedElement(partB1);
		MPerspective perspectiveB2 = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStackB.getChildren().add(perspectiveB2);
		MPart partB2 = BasicFactoryImpl.eINSTANCE.createPart();
		perspectiveB2.getChildren().add(partB2);
		perspectiveB2.setSelectedElement(partB2);
		initialize(applicationContext, application);
		getEngine().createGui(windowA);
		getEngine().createGui(windowB);
		EPartService windowPartServiceB = windowB.getContext().get(
				EPartService.class);
		assertEquals(windowA.getContext(), application.getContext()
				.getActiveChild());
		assertEquals(perspectiveB1.getContext(), windowB.getContext()
				.getActiveChild());
		windowPartServiceB.switchPerspective(perspectiveB2);
		assertEquals(windowA.getContext(), application.getContext()
				.getActiveChild());
		assertEquals(perspectiveB2.getContext(), windowB.getContext()
				.getActiveChild());
	}
	public void testSwitchPerspective04() {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window1 = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window1);
		application.setSelectedElement(window1);
		MWindow window2 = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window2);