[geary/wip/structured-logging] Add Geary.Logging.clear method, call it on app shutdown
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/structured-logging] Add Geary.Logging.clear method, call it on app shutdown
- Date: Sun, 30 Jun 2019 07:25:33 +0000 (UTC)
commit a0d2e7347b27c8e9dae710df2af46effe7970d53
Author: Michael Gratton <mike vee net>
Date: Sun Jun 30 16:43:15 2019 +1000
Add Geary.Logging.clear method, call it on app shutdown
src/client/application/geary-application.vala | 2 ++
src/engine/api/geary-logging.vala | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index de894601..e6e078f4 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -661,6 +661,8 @@ public class GearyApplication : Gtk.Application {
}
quit();
+
+ Geary.Logging.clear();
Util.Date.terminate();
}
diff --git a/src/engine/api/geary-logging.vala b/src/engine/api/geary-logging.vala
index 3d95a8c7..8eec7954 100644
--- a/src/engine/api/geary-logging.vala
+++ b/src/engine/api/geary-logging.vala
@@ -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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]