Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311758 - Removing adapters while closing a view.
Summary: Removing adapters while closing a view.
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.net4j (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-05 11:33 EDT by Michael Szediwy CLA
Modified: 2010-06-29 04:36 EDT (History)
0 users

See Also:


Attachments
Patch for Lifecycle.java (1.59 KB, patch)
2010-05-09 06:48 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Szediwy CLA 2010-05-05 11:33:14 EDT
Build Identifier: 3.0

When a CDO view gets closed it fires some lifecycle events. I tried to remove an adaper from a CDO object within during the deactivation. It throws an java.lang.IllegalStateException "View closed". Altough it is unnecessary to remove adapters when a view is closing it would be nice not to throw exceptions.

Reproducible: Always

Steps to Reproduce:
1.Open a CDO View and add an adapter to an CDO object.
2.Add a Lifecycle listener to the view and remove the adpater during aboutToDeactivate.
3.Close the view.
Comment 1 Michael Szediwy CLA 2010-05-05 11:33:57 EDT
[ERROR] View closed
java.lang.IllegalStateException: View closed
 at org.eclipse.emf.internal.cdo.util.FSMUtil.adapt(FSMUtil.java:122)
 at org.eclipse.emf.internal.cdo.view.CDOViewImpl$ChangeSubscriptionManager.subscribe(CDOViewImpl.java:2071)
 at org.eclipse.emf.internal.cdo.view.CDOViewImpl$ChangeSubscriptionManager.unsubscribe(CDOViewImpl.java:1959)
 at org.eclipse.emf.internal.cdo.view.CDOViewImpl.unsubscribe(CDOViewImpl.java:1637)
 at org.eclipse.emf.internal.cdo.view.CDOViewImpl.handleRemoveAdapter(CDOViewImpl.java:1618)
 at org.eclipse.emf.internal.cdo.CDOObjectImpl$1.didRemove(CDOObjectImpl.java:449)
 at org.eclipse.emf.internal.cdo.CDOObjectImpl$1.didRemove(CDOObjectImpl.java:1)
 at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:622)
 at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.remove(BasicNotifierImpl.java:170)
 at org.eclipse.emf.common.util.AbstractEList.remove(AbstractEList.java:466)
 at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.remove(BasicNotifierImpl.java:163)
Comment 2 Eike Stepper CLA 2010-05-09 06:48:04 EDT
Moving to Net4j, see patch for Lifecycle.java
Comment 3 Eike Stepper CLA 2010-05-09 06:48:47 EDT
Created attachment 167623 [details]
Patch for Lifecycle.java

Moving the state transition down in activate() and deactivate()
Comment 4 Eike Stepper CLA 2010-05-09 06:53:04 EDT
Committed to HEAD
Comment 5 Eike Stepper CLA 2010-06-29 04:36:22 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/