Bug 528330 - Concurrent changes can lead to data loss in the text widget
Summary: Concurrent changes can lead to data loss in the text widget
Status: VERIFIED FIXED
Alias: None
Product: EEF
Classification: Modeling
Component: User Interface (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal
Target Milestone: 2.0.1   Edit
Assignee: Pierre-Charles David CLA
QA Contact: Maxime Porhel CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-08 10:09 EST by Pierre-Charles David CLA
Modified: 2018-02-02 11:24 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2017-12-08 10:09:49 EST
Clone of bug #528134 to report the fix in EEF 2.0.x.

Steps to reproduce (in a Sirius context as it is easier, but the issue is not Sirius-specific):
1. Open a Sirius diagram which provides EEF-based properties view, and select an element which provides an editable text field (most obvious case: select an EClass in EcoreTools and use it's Name field). Say the class is named "A" initially, and thus the text field displays "A".
2. Launch a background job/thread which waits a few seconds and then renames "A" into "A2". I'll attach a patch to the Sirius Debugging View which provides buttons to launch such actions for testing.
3. While the job is waiting, start to edit the text field, for example into "A3". DO NOT VALIDATE YOUR EDITION.
4. When the background job finally performs the model change, the value being edited ("A3") is lost and unconditionally replaced with the new value computed from the new model state, "A2" => KO.

The example is a little contrived and simplified, but there are concrete scenarios where the resulting behavior is very bad: in particular when the user was editing a multi-line text field, which can take some time, and some background process (for example synchronization with remote changes) overwrites everything he had written with no chance at all to get it back.
Comment 1 Eclipse Genie CLA 2017-12-20 04:34:29 EST
New Gerrit change created: https://git.eclipse.org/r/114462
Comment 3 Eclipse Genie CLA 2018-01-15 09:19:19 EST
New Gerrit change created: https://git.eclipse.org/r/115394
Comment 4 Pierre-Charles David CLA 2018-01-24 09:31:57 EST
(In reply to Eclipse Genie from comment #3)
> New Gerrit change created: https://git.eclipse.org/r/115394

This new patch is for a different, but related case, where:
* the user selects and element E;
* in its properties view, it starts editing one of E's text properties by typing inside a text widget;
* before the user has validated his change (at this time, the new text only exists in the SWT widget), some background job takes a lock on element E;
* this lock triggers an update of all the properties widgets to make them read-only (and display a lock);
* at this point, the user can neither continue typing nor recover the text he was in the process of editing.

The proposed patch detects the situation where a lock it taken while the user is in the process of editing the text, and in this case opens a dialog box which a) explains the situation, and b) offers to copy the text into the system clipboard before it is lost. It's not very satisfying in terms of user interaction but for now I have not found a better way.
Comment 6 Pierre-Charles David CLA 2018-01-26 11:05:45 EST
Fixed by 0404d254e5e6fda22b6909957a5d6706ee24c270.
Comment 7 Maxime Porhel CLA 2018-01-31 07:34:33 EST
EEFTextLifecycleManager_textLossByLocking_message should be used as message and not the title in plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java Line 514
Comment 8 Eclipse Genie CLA 2018-01-31 07:36:52 EST
New Gerrit change created: https://git.eclipse.org/r/116430
Comment 10 Maxime Porhel CLA 2018-01-31 11:41:09 EST
Validated with Sirius 5.1.1
Comment 11 Eclipse Genie CLA 2018-02-02 11:24:53 EST
New Gerrit change created: https://git.eclipse.org/r/116623