| Summary: | [Progress] Race condition in ProgressManager.JobMonitor prevents subtask name from being displayed in progress monitor | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Steven Soloff <steven.soloff> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | remy.suen |
| Version: | 3.5.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: M20100211-1343 I believe I've observed a race condition in the org.eclipse.ui.internal.progress.ProgressManager.JobMonitor class. My application launches a search query via org.eclipse.search.ui.NewSearchUI.runQueryInBackground(). My ISearchQuery.run() method invokes IProgressMonitor.subTask(), which is ultimately handled by JobMonitor.subTask(). Apparently, sometimes my call to subTask() happens before JobMonitor.addProgressListener() is invoked by the framework to hook up the progress dialog to the JobMonitor, such that the following code in JobMonitor.subTask() is not executed: if (listener != null) { > listener.subTask(name); } A short time later, when JobMonitor.addProgressListener() is called, the subtask name is not copied to the listener (unlike the task name and the amount of work done): if (currentTask != null) { listener.beginTask(currentTaskName, currentTask.totalWork); listener.internalWorked(currentTask.preWork); } The end result is that the subtask name does not appear in the progress dialog displayed by the framework. In the cases where my call to subTask() occurs after the progress listener is added, the subtask name is displayed correctly. Would it be possible to copy over the subtask name as part of the listener initialization in JobMonitor.addProgressListener()? My naive suggestion would be something like: if (currentTask != null) { listener.beginTask(currentTaskName, currentTask.totalWork); listener.internalWorked(currentTask.preWork); + SubTaskInfo[] subTasks = (SubTaskInfo[])info.getChildren(); + if (subTasks.length > 0) { + listener.subTask(subTasks[0].getTaskName()); + } } Reproducible: Sometimes Steps to Reproduce: 1. Start a new search query via NewSearchUI.runQueryInBackground(). 2. Invoke IProgressMonitor.beginTask() followed by IProgressMonitor.subTask() from within your implementation of ISearchQuery.run(). 3. Ensure the task runs for a sufficient amount of time for the platform progress dialog to be displayed. 4. Observe the task name is displayed, but the subtask name is not (may or may not happen due to a race condition).