Commit 811a830
committed
fix: prevent tray click event listener from being added multiple times
- Remove existing listener before adding to ensure only one instance
- Prevents memory leak from repeated state transitions
- Ensures click handler is called exactly once per click
This fixes a potential memory leak where tray click listeners could
accumulate on repeated RUNNING state transitions. Each state change
to RUNNING would add a new listener without removing the old one,
leading to multiple stopRun() calls per click and gradual memory growth.
The fix uses defensive programming: always remove the listener before
adding it, ensuring exactly one listener is active regardless of how
many times the state transitions.
Severity: Medium-High (6-7/10)
Impact: Prevents memory leak and duplicate event handling1 parent de90499 commit 811a830
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
0 commit comments