| Summary: | Object is not detached from it's resource on unload | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Rimvydas <rimvydas> | ||||
| Component: | Core | Assignee: | Ed Merks <Ed.Merks> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Andreas.Muelder, pierre-charles.david | ||||
| Version: | 2.6.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 390022 | ||||||
| Attachments: |
|
||||||
|
Description
Rimvydas
Created attachment 196289 [details]
unit test
The fix is committed to CVS for EMF 2.8. The fix is available in a build. It seems that this bug fix causes regression to GMF see Bug #390022 Yes, GMF is calling internal APIs inappropriately. That method says
/**
* Sets this object to be directly contained by the resource
* and returns accumulated notifications.
* This is only done as the inverse of {@link Resource#getContents()}<code>.add(this)</code>.
* @return accumulated notifications.
*/
NotificationChain eSetResource(Resource.Internal resource, NotificationChain notifications);
I.e., it's only called as part of bidirectional handshaking. Calling it directly will leave things in an inconsistent state. I.e., the other half of the bidirectional isn't updated.
In a newsgroup posting in July I suggested:
The GMF code should be using resource.getContents().remove(...). I.e., perhaps it should be referencedObject.eResource().getContents().remove(referencedObject) though I'm not sure if the referenced object is necessarily contained directly in a resource so maybe it should check that eResource() isn't null.
You should open a bugzilla for the GMF runtime to fix this.
Thanks for clarification, your suggestion works very well. I provided a patch for the GMF bug. |