ZaneDubya/UltimaXNA

Unsubscribe from all events throughout codebase.

Closed this issue · 0 comments

@jeffboulanger pointed out that I've been subscribing to events and not unsubscribing when the event receiving object is Disposed(). This will inevitably cause memory leaks - some severe. For example Jeff noticed the journal gump leaks a ton of memory.

For each of the items you do a += with:
1.
public Action OnJournalEntryAdded = null;
becomes
public event Action OnJournalEntryAdded;
2.
All of your gumps that subscribe to anything
should -= that event, when they close, if they are never going to be opened again

Thanks jeff!