EventManager never unreferences SettingsManagers from Preferences
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Exaile |
Fix Released
|
High
|
Unassigned |
Bug Description
When a preference panel is opened, the prefs panel makes a clone of the current SettingsManager for a scratch pad. When the window is closed, these clones are never freed. The reason for this is because each SettingsManager instance adds an event to EventManager: every 30 seconds the SettingsManager should be saved. This will hold the reference to the clone alive indefinately causing (eventually) a memory leak. There are a few possible solutions to this:
* Weak reference event manager - an object can add a function and, in the event manager, only a weak reference will be kept. This seems to be the best if not just for completeness in the event manager.
* SettingsManagers will not add a tick event if there is no location to save to (clones will have their 'loc' property set to None)
* dereference events explicitly, OK and Cancel callbacks for the preference pane will call a destroy() on settings as necessary.
Steps to reproduce:
1. check out trunk -r 1868
2. apply attached patch
3. run exaile in terminal
4. while bored or not satisfied:
i. open preferences
ii. close preferences
5. note in the console saves are still being called for preference panes 1..n (0 is the main one for exaile)
Changed in exaile: | |
status: | Fix Committed → Fix Released |
we really should make the event system use weakrefs instead of normal refs, then things like this couldn't happen.