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
[teleinfo] Fix memory leak #9724
Conversation
...a/org/openhab/binding/teleinfo/internal/handler/TeleinfoAbstractElectricityMeterHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh>
Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh>
11cb5cc
to
0342cb8
Compare
@cpmeister Thank you for the tip! I've pushed a new version of the fix, can you check? |
if (bridgeStatusInfo.getStatus() != ThingStatus.ONLINE) { | ||
if (controllerHandler != null) { | ||
controllerHandler.removeListener(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should make sure that this gets called when the TeleinfoAbstractElectricityMeterHandler is disposed as well.
Looks like you need to override the dispose
method to get that done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh>
* Use set instead list to avoid duplicate listeners * Remove from listeners when bridge is not ONLINE * Unsubscribe from bridge handler events when thing handler is disposed
* Use set instead list to avoid duplicate listeners * Remove from listeners when bridge is not ONLINE * Unsubscribe from bridge handler events when thing handler is disposed Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh> Signed-off-by: John Marshall <john.marshall.au@gmail.com>
* Use set instead list to avoid duplicate listeners * Remove from listeners when bridge is not ONLINE * Unsubscribe from bridge handler events when thing handler is disposed Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh>
* Use set instead list to avoid duplicate listeners * Remove from listeners when bridge is not ONLINE * Unsubscribe from bridge handler events when thing handler is disposed Signed-off-by: Olivier Marceau <hollysaiqs@marceau.ovh>
Resolve #9546.
This PR prevents the
ThingHandler
from registering more than once to the bridge event when abridgeStatusChanged
is triggered.