This patch solves the following memory/resource leak problems:
(a) Gee.TreeSet doesn't drop references when destroyed. Fixed by
using a subclass that clears the set when destroyed (exactly same
as patch made to Gee, however that won't be in distribution for
awhile.)
(b) Imap.ClientSession was holding refs to CommandResponses after
they'd been completed. They're now dropped.
(c) Imap.ClientSessionManager now has an open/close_async() (called
by Imap.Account.open/close_async()) that drops all ClientSessions.
(d) All classes in Engine (and some in the client) use Geary.BaseObject,
which uses a static map to track outstanding held references to
it. The table is dumped when Geary exits. Must be enabled with a
./configure flag.
Two outstanding memory leaks persist (one for Imap.ResponseCodes and
another when messages are selected/deselected), so this doesn't close
the ticket, but testing and use has shown these changes to make a huge
improvement on memory usage and reducing crashes.
EmailFlags seemed to be a natural fit for EmailProperties, but
it became apparent that EmailFlags change all the time (and must
be polled to notice changes) while other properties are immutable.
For efficiency, moved EmailFlags out of EmailProperties and made
them their own Email.Field. EmailProperties may expand later to
supply user-visible information; for now, only used internally by
the IMAP stack.
message (email), suitable for decoding a message off the wire or converting a
human-generated form into something suitable for pushing on the wire via SMTP.
This adds an SMTP library into Geary that can perform basic client submission of emails.
The interface is exposed generically through the Geary.EngineAccount interface.