Skip to content

Dispose SourceViewerDecorationSupport in QuickSearchDialog - #4220

Open
mx990 wants to merge 2 commits into
eclipse-platform:masterfrom
mx990:quick-search-dispose-viewer-decoration-support
Open

Dispose SourceViewerDecorationSupport in QuickSearchDialog#4220
mx990 wants to merge 2 commits into
eclipse-platform:masterfrom
mx990:quick-search-dispose-viewer-decoration-support

Conversation

@mx990

@mx990 mx990 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The QuickSearchDialog did not dispose the SourceViewerDecorationSupport created in createViewerDecorations(), leading to a resource leak. This disposes SourceViewerDecorationSupport when closing the dialog.

mx990 and others added 2 commits August 3, 2026 15:09
The QuickSearchDialog did not dispose the SourceViewerDecorationSupport
created in createViewerDecorations(), leading to a resource leak.
This disposes SourceViewerDecorationSupport when closing the dialog.
@eclipse-platform-bot

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 221b87f48ad337067f76ede9820ec22dbc2bcd63 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Mon, 3 Aug 2026 13:19:46 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF b/bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF
index c81a682902..9bbeb36695 100644
--- a/bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.text.quicksearch;singleton:=true
-Bundle-Version: 1.3.500.qualifier
+Bundle-Version: 1.3.600.qualifier
 Bundle-Activator: org.eclipse.text.quicksearch.internal.ui.QuickSearchActivator
 Require-Bundle: org.eclipse.ui;bundle-version="[3.113.0,4.0.0)",
  org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)",
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks correct to me.

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I wonder about the dispose method being a better place.

https://github.com/mx990/eclipse.platform.ui/blob/4b21b7cdb91e96b34dc5c88db9d26b137b0948ba/bundles/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java#L1022

Is it always the case that close is called, e.g., even if you it escape? Of course most of the other disposes are in close, so it's already a bit in a confusing state...

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Test Results

   858 files  ±0     858 suites  ±0   47m 19s ⏱️ -44s
 8 129 tests ±0   7 886 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 289 runs  ±0  19 635 ✅ ±0  654 💤 ±0  0 ❌ ±0 

Results for commit 4b21b7c. ± Comparison against base commit ae00a08.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a resource leak in the QuickSearch UI by ensuring SourceViewerDecorationSupport is properly tracked and disposed when the dialog is closed.

Changes:

  • Store SourceViewerDecorationSupport as a dialog field instead of a local variable.
  • Dispose the SourceViewerDecorationSupport instance during QuickSearchDialog#close().
  • Bump org.eclipse.text.quicksearch bundle version.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
bundles/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java Track and dispose SourceViewerDecorationSupport to address a leak on dialog close.
bundles/org.eclipse.text.quicksearch/META-INF/MANIFEST.MF Increment bundle version to reflect the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +585 to +588
if (sourceViewerDecorationSupport != null) {
sourceViewerDecorationSupport.dispose();
sourceViewerDecorationSupport = null;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this is the fishy part. What else in close should actually be moved to dispose such that it's always done and always only once?

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take my approval back because while it looks correct, it only looks correct because other things are disposed in close, but I don't think that was correct before this change...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants