Bug 227145 - Racing condition in diff module selects another difference after display
Racing condition in diff module selects another difference after display
Status: RESOLVED FIXED
Product: utilities
Classification: Unclassified
Component: Diff
7.4
PC All
: P3 (vote)
: 7.4
Assigned To: Tomas Stupka
diff-issues@utilities
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-07 09:43 UTC by emi
Modified: 2013-06-05 09:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2013-03-07 09:43:33 UTC
There is a (minor) racing condition in EditableDiffView and related classes.

If the RefreshDiffTask finishes *before* the UI has finished revalidating, it will change the selected difference.

See this video http://youtu.be/eRj9IJj1fKM and note how difference 4/5 is automatically selected.

Normally 1/5 should be the selected difference.

The relevant stacktraces are:

org.netbeans.spi.diff.DiffControllerImpl.setDifferenceIndex(DiffControllerImpl.java)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView.setDifferenceImpl(EditableDiffView.java:500)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView.access$1600(EditableDiffView.java:114)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView$2.run(EditableDiffView.java:395)
org.netbeans.modules.diff.builtin.visualizer.editable.DiffViewManager.runWithSmartScrollingDisabled(DiffViewManager.java:117)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView.setLocation(EditableDiffView.java:392)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView.setCurrentDifference(EditableDiffView.java:763)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView$RefreshDiffTask$1.run(EditableDiffView.java:1390)

and

org.netbeans.spi.diff.DiffControllerImpl.setDifferenceIndex(DiffControllerImpl.java)
org.netbeans.modules.diff.builtin.visualizer.editable.EditableDiffView.updateCurrentDifference(EditableDiffView.java:801)
org.netbeans.modules.diff.builtin.visualizer.editable.DiffViewManager.stateChanged(DiffViewManager.java:152)
javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:348)
javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:285)
javax.swing.JScrollBar.setValues(JScrollBar.java:592)
javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport(BasicScrollPaneUI.java:272)
javax.swing.plaf.basic.BasicScrollPaneUI$Handler.viewportStateChanged(BasicScrollPaneUI.java:1067)
javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(BasicScrollPaneUI.java:1009)
javax.swing.JViewport.fireStateChanged(JViewport.java:1432)
javax.swing.JViewport.setViewSize(JViewport.java:1088)
javax.swing.ViewportLayout.layoutContainer(ViewportLayout.java:183)
java.awt.Container.layout(Container.java:1419)
java.awt.Container.doLayout(Container.java:1408)
java.awt.Container.validateTree(Container.java:1505)
java.awt.Container.validateTree(Container.java:1511)
java.awt.Container.validate(Container.java:1478)
javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:670)
Comment 1 Ondrej Vrabec 2013-06-04 13:18:49 UTC
fix: http://hg.netbeans.org/core-main/rev/fd23b684d70e
Comment 2 Quality Engineering 2013-06-05 09:33:57 UTC
Integrated into 'main-golden', will be available in build *201306050626* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fd23b684d70e
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #227145 - Racing condition in diff module selects another difference after display
trying a simple fix: update the difference only when the scrollbar is really moved


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo