Add Geary.Logging.clear method, call it on app shutdown

This commit is contained in:
Michael Gratton 2019-06-30 16:43:15 +10:00
parent 95e856b664
commit a0d2e7347b
2 changed files with 19 additions and 0 deletions

View file

@ -661,6 +661,8 @@ public class GearyApplication : Gtk.Application {
}
quit();
Geary.Logging.clear();
Util.Date.terminate();
}

View file

@ -350,6 +350,23 @@ public void init() {
max_log_length = DEFAULT_MAX_LOG_BUFFER_LENGTH;
}
/**
* Clears all log records.
*
* Since log records hold references to Geary engine objects, it may
* be desirable to clear the records prior to shutdown so that the
* objects can be destroyed.
*/
public void clear() {
record_lock.lock();
first_record = null;
last_record = null;
log_length = 0;
record_lock.unlock();
}
/**
* Replaces the current logging flags with flags. Use Geary.Logging.Flag.NONE to clear all
* logging flags.