Skip to content

Commit 444e263

Browse files
committed
Cancel Quick Access compute on dispose to stop orphaned jobs
doDispose() left computeProposalsJob running, so a closed dialog kept querying providers and lingered in COMPUTE_JOB_FAMILY. The setUp warmup made this visible: it set "t", waited only for the first results, then closed the dialog while the lazy providers were still cold-initializing on the worker. That orphaned job stayed in the family and, on a loaded macOS runner, could outlive a test's 30 s waitForQuickAccessResults wait, which waits for the whole family to drain (issue #4009, testPreviousChoicesAvailableForExtension). Cancel the compute job in doDispose so a closed dialog stops computing and leaves the family promptly. Make the warmup wait for results and for the compute job to drain, so the providers' slow first query finishes in setUp rather than leaking into a test's timed wait.
1 parent f9b887f commit 444e263

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ protected Pattern getCategoryPattern() {
644644
}
645645

646646
private void doDispose() {
647+
// Stop any in-flight compute so a closed dialog neither keeps querying providers
648+
// nor leaves a job lingering in COMPUTE_JOB_FAMILY.
649+
if (computeProposalsJob != null) {
650+
computeProposalsJob.cancel();
651+
computeProposalsJob = null;
652+
}
647653
if (textLayout != null && !textLayout.isDisposed()) {
648654
textLayout.dispose();
649655
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/QuickAccessDialogTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ public void setUp() throws Exception {
124124
Text warmupText = warmupDialog.getQuickAccessContents().getFilterText();
125125
Table warmupTable = warmupDialog.getQuickAccessContents().getTable();
126126
warmupText.setText("t");
127-
DisplayHelper.waitForCondition(warmupText.getDisplay(), WARMUP_TIMEOUT, () -> warmupTable.getItemCount() > 0);
127+
// Wait for results AND for the compute job to drain, so the lazy providers'
128+
// slow first query completes here rather than leaking into a test's timed wait.
129+
DisplayHelper.waitForCondition(warmupText.getDisplay(), WARMUP_TIMEOUT,
130+
() -> warmupTable.getItemCount() > 0
131+
&& Job.getJobManager().find(QuickAccessContents.COMPUTE_JOB_FAMILY).length == 0);
128132
providersWarmedUp = true;
129133
}
130134
warmupDialog.close();

0 commit comments

Comments
 (0)