Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 502180

Summary: Resource reload on external changes invoke an EEF refresh in a wrong context
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: PropertiesAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: major    
Priority: P3 CC: julien.dupont, steve.monnier
Version: 4.0.0Keywords: triaged
Target Milestone: 4.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/81984
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1d4983b3a0bc0a3f0fb6c4e9ffdee938ec2385d1
Whiteboard: needtest
Attachments:
Description Flags
Video illustrating the bug none

Description Pierre-Charles David CLA 2016-09-26 11:56:38 EDT
Steps to reproduce:
1. Open a Sirius diagram on a semantic model M, with the properties view enabled.
2. Open the semantic model in a separate (non-Sirius) EMF tree editor.
3. In the (non-EEF-based) property view of the EMF editor, change the semantic model. Save.

An error occurs, with a message similar to this:

An issue has occurred during the evaluation of 'aql:self.executeOperation('platform:/plugin/org.eclipse.sirius.ui.properties/model/properties.odesign#//@groups.0/@controls.0/@ifs.0/@widget/@initialOperation')'.
executeOperation(org.eclipse.emf.ecore.EObject,java.lang.String) with arguments [org.eclipse.emf.ecore.impl.EPackageImpl@20dcc146 (eProxyURI: platform:/resource/extlibrary/extlibrary.ecore#/), platform:/plugin/org.eclipse.sirius.ui.properties/model/properties.odesign#//@groups.0/@controls.0/@ifs.0/@widget/@initialOperation] failed:
    null

On first analysis, what happens is:
1. Sirius detects the semantic model changing in the workspace.
2. It reloads the new version of the resource in the session.
3. The new version of the resource triggers a refresh, which changes the diagram's model. This is done in a transaction, so after the refresh is done, EMF Tx launches the registered post-commit listeners.
4. One of these is org.eclipse.sirius.ui.properties.internal.TransactionalEditingDomainContextAdapter.Listener, which is in charge of refreshing the EEF-based properties view when the model changes from inside Sirius. It ends up invoking org.eclipse.eef.ide.ui.internal.Updater.apply(List<Notification>), which calls org.eclipse.eef.properties.ui.api.EEFTabbedPropertySheetPage.refreshPage().
5. Because the EEF view is not actually visible, it still holds on to the old pre-reload version of the variables (e.f. "self"), so when it calls STS.executeOperation(), it is on a target element which is now a proxy. This is not a case which was envisioned and it crashes.
Comment 1 Pierre-Charles David CLA 2016-09-27 04:37:25 EDT
Created attachment 264443 [details]
Video illustrating the bug

This is using:
- Sirius v4.0.0-262-g30f2c09
- EEF v1.7.0_M2-14-g4e21ca9
Comment 2 Eclipse Genie CLA 2016-09-27 08:30:23 EDT
New Gerrit change created: https://git.eclipse.org/r/81984
Comment 4 Pierre-Charles David CLA 2016-10-04 09:49:28 EDT
Fixed.
Comment 5 Pierre-Charles David CLA 2016-10-18 11:07:56 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.