Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream memory leak fix for ScopedPreferenceStore #2878

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pazi146
Copy link

@pazi146 pazi146 commented Apr 1, 2025

introduce fix created by Sebastian Zarnekow:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=239033
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362199

Also-By: Sebastian Zarnekow [email protected]

Context: #2875

@@ -224,8 +247,9 @@ private IEclipsePreferences getDefaultPreferences() {

@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
initializePreferencesListener();// Create the preferences listener if it
// does not exist
// Create the preference listeners if they do not exist
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the life-cycle of the listener is solely bound to the IPropertyChangeListener, I therfore think it would be better to instead of handling it "globally" to instead have a wrapped listener object that is forwarding the events directly instead of holding an own instance in the store.

Copy link
Author

Choose a reason for hiding this comment

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

What do you mean with a wrapped listener object?

It isn't dependent on a single IPropertyChangeListener but on the fact if any listeners are attached at all - no use listening if there is nothing to forward it to.

This copies over the relevant changes from: https://github.com/eclipse-xtext/xtext/blob/main/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/preferences/FixedScopedPreferenceStore.java

Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't dependent on a single IPropertyChangeListener but on the fact if any listeners are attached at all

Instead of one "global" listener used for all IPropertyChangeListener it should wrap this one into the required type and use this for the life-cycle management.

@laeubi
Copy link
Contributor

laeubi commented Apr 3, 2025

@pazi146 I have now created a PR can you check if it solves your observed problem?

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.

2 participants