Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311792 - [flex-hierarhcy] Refreshing an un-expended element doesn't clear its children.
Summary: [flex-hierarhcy] Refreshing an un-expended element doesn't clear its children.
Status: RESOLVED DUPLICATE of bug 311442
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-05 16:22 EDT by Pawel Piech CLA
Modified: 2010-07-20 12:44 EDT (History)
1 user (show)

See Also:


Attachments
Tests reproducing the bug. (13.09 KB, patch)
2010-05-05 16:23 EDT, Pawel Piech CLA
no flags Details | Diff
Fixes for the bug. (7.79 KB, patch)
2010-05-05 16:24 EDT, Pawel Piech CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Piech CLA 2010-05-05 16:22:53 EDT
This bug is a duplicate of JFace bug 311422, but it applies only to the flexible hierarchy viewer.  The flexible hierarchy viewer extends the JFace TreeViewer but it overrides some of its methods.  As a result some of the bugs have to be fixed in parallel.

In summary: the bug occurs when an element with children is expanded then collapsed.  Then the parent element is refreshed, and it's children are refreshed too.  In the small window of time between when the parent element is requested to refresh but the model has not called setHasChildren(), the children elements can be requested to refresh as well which leads to incorrect list of children in the parent element when that element is expanded.

The severity of this bug is not high because the timing of the updates is very important and the only use case in debugger where we've observed this is bug 305177, which has a work around for this bug.
Comment 1 Pawel Piech CLA 2010-05-05 16:23:52 EDT
Created attachment 167224 [details]
Tests reproducing the bug.
Comment 2 Pawel Piech CLA 2010-05-05 16:24:10 EDT
Created attachment 167225 [details]
Fixes for the bug.
Comment 3 Pawel Piech CLA 2010-05-05 16:27:31 EDT
Darin, do you think fixing this bug is worth the risk in 3.6?  The original bug 305177 has a workaround.
Comment 4 Darin Wright CLA 2010-05-06 10:06:28 EDT
(Note the bug number in the original comment is off by one - it should read that his is a duplicate of bug 311442).

These changes look good to me. Although I prefer to fix this bug, and avoid the workarounds in bug 305177, the tests did not all pass for me on Windows:

org.eclipse.core.commands.ExecutionException: Test failed: Timed Out: Viewer Update Listener
	fLabelUpdatesComplete = true
	fLabelUpdatesRunning = 0
	fLabelUpdates = (EMPTY)
	fViewerUpdatesComplete = true
	fViewerUpdatesRunning = 0
	fHasChildrenUpdates = (EMPTY)
	fChildCountUpdates = (EMPTY)
	fChildrenUpdates = (EMPTY)
	fStateRestoreComplete = false
	fProxyModels = []
	fTimeoutInterval = 60000
 fListener = Viewer Update Listener
	fLabelUpdatesComplete = true
	fLabelUpdatesRunning = 0
	fLabelUpdatesRunning = []
	fLabelUpdatesCompleted = [ILabelUpdate: 3.1.1, ILabelUpdate: 5.1, ILabelUpdate: 4.1, ILabelUpdate: 3.1, ILabelUpdate: 3.1.1, ILabelUpdate: 3, ILabelUpdate: 2.1, ILabelUpdate: 5.1.1, ILabelUpdate: 6, ILabelUpdate: 4, ILabelUpdate: 2, ILabelUpdate: 3, ILabelUpdate: 4, ILabelUpdate: 5, ILabelUpdate: 5, ILabelUpdate: 6.1, ILabelUpdate: 6]
	fLabelUpdates = (EMPTY)
	fViewerUpdatesComplete = true
	fViewerUpdatesRunning = 0
	fHasChildrenUpdatesRunning = []
	fHasChildrenUpdatesCompleted = [IHasChildrenUpdate: 5.1, IHasChildrenUpdate: 6.1, IHasChildrenUpdate: 6, IHasChildrenUpdate: 3.1, IHasChildrenUpdate: 4, IHasChildrenUpdate: 5.1.1, IHasChildrenUpdate: 5, IHasChildrenUpdate: 5, IHasChildrenUpdate: 3.1.1, IHasChildrenUpdate: 2, IHasChildrenUpdate: 4, IHasChildrenUpdate: 6, IHasChildrenUpdate: 4.1, IHasChildrenUpdate: 3, IHasChildrenUpdate: 2.1, IHasChildrenUpdate: 3]
	fHasChildrenUpdates = (EMPTY)
	fChildCountUpdatesRunning = []
	fChildCountUpdatesCompleted = [IChildrenCountUpdate: 5, IChildrenCountUpdate: 3.1, IChildrenCountUpdate: 2, IChildrenCountUpdate: 6.1, IChildrenCountUpdate: 4, IChildrenCountUpdate: 6, IChildrenCountUpdate: 3, IChildrenCountUpdate: 3, IChildrenCountUpdate: 5, IChildrenCountUpdate: 2.1, IChildrenCountUpdate: root, IChildrenCountUpdate: 5, IChildrenCountUpdate: 5.1]
	fChildCountUpdates = (EMPTY)
	fChildrenUpdatesRunning = []
	fChildrenUpdatesCompleted = [IChildrenUpdate: 3 {0->1}, IChildrenUpdate: root {0->6}, IChildrenUpdate: 6 {0->1}, IChildrenUpdate: 5.1 {0->1}, IChildrenUpdate: root {2->5}, IChildrenUpdate: root {1->2}, IChildrenUpdate: 3.1 {0->1}, IChildrenUpdate: 4 {0->1}, IChildrenUpdate: 2 {0->1}, IChildrenUpdate: 5 {0->1}]
	fChildrenUpdates = (EMPTY)
	fModelChangedComplete = true
	fStateRestoreComplete = false
	fProxyModels = []
	fTimeoutInterval = 60000
	at org.eclipe.debug.tests.viewer.model.StateTests.runTest(StateTests.java:84)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:116)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:47)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.RuntimeException: Timed Out: Viewer Update Listener
	fLabelUpdatesComplete = true
	fLabelUpdatesRunning = 0
	fLabelUpdates = (EMPTY)
	fViewerUpdatesComplete = true
	fViewerUpdatesRunning = 0
	fHasChildrenUpdates = (EMPTY)
	fChildCountUpdates = (EMPTY)
	fChildrenUpdates = (EMPTY)
	fStateRestoreComplete = false
	fProxyModels = []
	fTimeoutInterval = 60000
	at org.eclipe.debug.tests.viewer.model.TestModelUpdatesListener.isFinished(TestModelUpdatesListener.java:284)
	at org.eclipe.debug.tests.viewer.model.StateTests.testPreserveExpandedOnMultLevelContent(StateTests.java:374)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at org.eclipe.debug.tests.viewer.model.StateTests.runTest(StateTests.java:82)
	... 42 more
Comment 5 Pawel Piech CLA 2010-05-06 12:56:56 EDT
(In reply to comment #4)
> These changes look good to me. Although I prefer to fix this bug, and avoid the
> workarounds in bug 305177, the tests did not all pass for me on Windows:

I should have been more clear about the workaround in bug 305177.  This workaround involves expanding the parent container when child breakpoints are added to it.  It is actually a desired feature but it happens to also work around this bug in the process.  

I think this is a relatively small risk change, but I'd like to see what the JFace guys say about it (it being the original bug 311442) before committing the fix for RC1.

Also, you indicated that the test failure may have been due to user interference during the test, could you confirm that?
Comment 6 Darin Wright CLA 2010-05-06 13:43:29 EDT
(In reply to comment #5)
> Also, you indicated that the test failure may have been due to user
> interference during the test, could you confirm that?

The tests have passed every time I've run them since the failure... so I think it was user error (hiding a view that needed to be exposed to update).
Comment 7 Pawel Piech CLA 2010-05-13 12:09:40 EDT
My fix is not good, because it materializes all items in the tree.  I don't have any alternative fix right now so we'll have to think about it past 3.6.
Comment 8 Pawel Piech CLA 2010-07-20 12:44:57 EDT
Since 3.6 is shipped and my attempted fix is no good, there's no need to keep this bug as separate from the original.

*** This bug has been marked as a duplicate of bug 311442 ***