osu-framework
osu-framework copied to clipboard
`ConfigManager` can save after disposal
Noticed this when looking into https://github.com/ppy/osu-framework/issues/4950.
~~Since saves are debounced, this can easily happen if a save is queued right before disposal.~~ (Doesn't happen because the current == lastSave check will probably fail.)
Nothing bad really happens, it's just weird to me that this can happen.
QueueBackgroundSave() and Save() should probably throw if disposed. But the task in QueueBackgroundSave() should silently fail.
If this is alright with you, let me know so I can PR it.
I think what would make the most sense here is to throw ObjectDisposedException in QueueBackgroundSave and Save (and probably in all other public methods too?), and unbind all QueueBackgroundSave events from the config bindables on disposal (should be safe to just perform UnbindAll).
Throwing an exception sounds amicable.