Dispose SourceViewerDecorationSupport in QuickSearchDialog - #4220
Conversation
|
This pull request changes some projects for the first time in this development cycle. 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 patchFurther information are available in Common Build Issues - Missing version increments. |
There was a problem hiding this comment.
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
SourceViewerDecorationSupportas a dialog field instead of a local variable. - Dispose the
SourceViewerDecorationSupportinstance duringQuickSearchDialog#close(). - Bump
org.eclipse.text.quicksearchbundle 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.
| if (sourceViewerDecorationSupport != null) { | ||
| sourceViewerDecorationSupport.dispose(); | ||
| sourceViewerDecorationSupport = null; | ||
| } |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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...
The QuickSearchDialog did not dispose the SourceViewerDecorationSupport created in createViewerDecorations(), leading to a resource leak. This disposes SourceViewerDecorationSupport in the dispose listener of the dialog. Furthermore, most resources were only disposed in close(), but not in the separate dispose listener, which could also lead to a resource leak when closing the dialog abnormally, such as when disposing the Shell. This also moves the other cleanup code from close() to the dispose listener.
4b21b7c to
66b9e7c
Compare
|
You are right, I was able to identify a case where |
merks
left a comment
There was a problem hiding this comment.
This looks for consistent. I tested it in a self-host launch. I'm not sure in which case close is not called. Even when I hit esc it's called. But this does seem more logical and consistent.
|
Ah, I read your comment about when close is not called after I wrote my comment. 😁 |
The
QuickSearchDialogdid not dispose theSourceViewerDecorationSupportcreated increateViewerDecorations(), leading to a resource leak. This disposesSourceViewerDecorationSupportwhen closing the dialog.