Closed maarzt closed 1 year ago
I would like to make the AppModel
final in an instance, to diminish the amount of logic dealing with mutable AppModel
field. Maybe we could add a listener system instead? Inside the AppModel
?
This issue was closed in #245
Problem
Currently there is no way for a MastodonPlugin to get notified when the Mastodon project is closed. This means it cannot free resources, that are associated with the Mastodon project or do other operations like storing settings etc. that would usually be done when closing a project.
This is a problem for the Lineage Registration plugin in mastodon-tomancak. The plugin keeps a list of opened Mastodon projects. But a Mastodon project is never removed from that list because the plugin simply doesn't know if a project gets closed or not.
Potential Solution (deprecated)
TheMastodonPlugin
interface has a method that is called whenever a new Mastodon project is opened:https://github.com/mastodon-sc/mastodon/blob/a965612e7890ec624232fc69c7431badd65c18d3/src/main/java/org/mastodon/app/plugin/MastodonPlugin.java#L51
We could add a similar method:
that is called whenever the Mastodon project is closed.
Preferred Solution
Add
closingListerners
to theAppModel
. A plugin can listen to theAppModel
and would be notified when theAppModel
is closed.