Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346378 - [Legacy] Deleting legacy elements failure
Summary: [Legacy] Deleting legacy elements failure
Status: CLOSED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.legacy (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Fluegge CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-19 03:49 EDT by Alex Lagarde CLA
Modified: 2012-09-21 06:51 EDT (History)
1 user (show)

See Also:


Attachments
A simple metamodel allowing to reproduce this issue (751 bytes, application/octet-stream)
2011-05-19 03:49 EDT, Alex Lagarde CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Lagarde CLA 2011-05-19 03:49:06 EDT
Created attachment 196077 [details]
A simple metamodel allowing to reproduce this issue

Issue description
===================
When using a very simple metamodel in legacy mode, the objects wrapped by the CDOLegacyWrapper are not properly deleted.

When trying to delete a "Car" for its "Garage" container (contained in the "cars" reference), the following methods are called : 

CDOLegacyAdapter(CDOLegacyWrapper).adjustOppositeReference(InternalCDOObject, EObject, EReference) line: 809	
CDOLegacyAdapter(CDOLegacyWrapper).cdoInternalPostDetach(boolean) line: 173	
CDOStateMachine.detach(InternalCDOObject) line: 271	
CDOResourceImpl.detached(EObject) line: 1187	
CarImpl(BasicEObjectImpl).eBasicSetContainer(InternalEObject, int, NotificationChain) line: 1334	
CarImpl(BasicEObjectImpl).eInverseRemove(InternalEObject, int, Class<?>, NotificationChain) line: 1451	
EObjectContainmentEList$Resolving<E>(EcoreEList<E>).inverseRemove(E, NotificationChain) line: 328	
EObjectContainmentEList$Resolving<E>(NotifyingListImpl<E>).remove(int) line: 716	
EObjectContainmentEList$Resolving<E>(AbstractEList<E>).remove(Object) line: 466	
EcoreUtil.remove(EObject, EStructuralFeature, Object) line: 3030

When I inspect the container just after the call to ECoreUtil.remove, my Garage still contains the deleted Car. 
However, calling deletedCar.eContainer() returns null.

Possible causes
===================
CDOLegacyWrapper.adjustOppositeReference() calls CDOLegacyWrapper.adjustTransientOppositeReference(), which adds the deleted Car to the "cars" reference of the Garage. This does not seems right, but you must have a good reason to do so.
Comment 1 Martin Fluegge CLA 2011-05-19 04:23:09 EDT
Hi Alex,

could you try to reproduce this issue with HEAD. The Legacy wrapper currently does not use the method *adjustOppositeReference(InternalCDOObject,
EObject, EReference)* anymore. Which version of CDO are you using?
Comment 2 Alex Lagarde CLA 2011-05-27 09:18:24 EDT
Hi Martin,

sorry for the delay, updating our environment was not what one could call an easy task :)

I've tried to reproduce this issue on the latest stable build (RC2a), it now works fine.

Thanks for your help !
Alex
Comment 3 Martin Fluegge CLA 2011-05-27 12:33:16 EDT
You are welcome :)
Comment 4 Eike Stepper CLA 2012-09-21 06:51:16 EDT
Closing.