I have an object that starts an activity and when I test I just throw away the object and I build a new one. But the code path never cleans up the session data from that activity. Do object have a DESTROY functionality where I can do sane destroying of an object?
eg
class Foo {
private var session;
// More code here
// and somewhere session.start() is called
function DESTROY() {
if (self.session != null) {
self.session.stop();
self.session.discard();
}
// More cleanup here
}
}