Skip to content

Persist Teruglevering overlay toggle + fix timer memory leak#27

Open
grmt wants to merge 2 commits into
ToonSoftwareCollective:mainfrom
grmt:persist-production-toggle
Open

Persist Teruglevering overlay toggle + fix timer memory leak#27
grmt wants to merge 2 commits into
ToonSoftwareCollective:mainfrom
grmt:persist-production-toggle

Conversation

@grmt

@grmt grmt commented Jun 17, 2026

Copy link
Copy Markdown

Summary

  • Production toggle persistence: the "Teruglevering" overlay (showSpecialBar2) on the today graph was hardcoded to false, so the user's choice was lost on every navigation. Replaced the static green legend square with a SolarPowerCheckbox that controls the overlay live and saves the state to solarpanel_userSettings.json via the existing saveSettings() / getSettings() mechanism.
  • Memory leak fix: all four delay timer functions (solarDelay, zonneplanDelay, zonneplanRegisterDelay, solarEnphaseDelay) called Signal.connect(cb) on every invocation without a matching disconnect(). Qt never removes slots automatically, so connections accumulated indefinitely — each closure staying alive forever and the callback firing multiple times per trigger. Replaced with a stored-callback property pattern that avoids signal accumulation entirely.

Test plan

  • Navigate to the Stroom nu tile → graph screen, check "Teruglevering", navigate away and back — overlay should still be checked and visible
  • Setting persists across a Qt GUI restart
  • Unchecking hides the green overlay again
  • No regressions on the Solar/inverter data display

🤖 Generated with Claude Code

grmt and others added 2 commits June 17, 2026 15:03
The showSpecialBar2 flag on the today graph was hardcoded to false,
so the Teruglevering overlay was never shown and the user's choice
was lost on every navigation.

- SolarPanelApp: add showProduction property
- SolarGeneralProc: load/save showProduction in getSettings/saveSettings
- SolarPanelScreen: bind showSpecialBar2 to app.showProduction; replace
  static Teruglevering legend with a SolarPowerCheckbox that toggles
  the overlay and saves the setting immediately on change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signal.connect(cb) was called on every invocation of solarDelay(),
zonneplanDelay(), zonneplanRegisterDelay(), and solarEnphaseDelay()
without a matching disconnect(). Qt never removes slots automatically,
so each call added another connection: after N calls the timer fired
N callbacks and kept N closures alive indefinitely.

Replace with a stored-callback pattern: the callback is held in a
property on the Timer, cleared in onTriggered before being called, and
the timer is stopped before each restart so a pending fire cannot race
with the new callback. The *DelayStop() functions also null the callback
so the closure is released immediately when a timer is cancelled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@grmt

grmt commented Jun 17, 2026

Copy link
Copy Markdown
Author

oef, da's een beetje voortvarend van Claude, ik moet het nog testen

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.

1 participant