[geary/mjog/misc-criticals: 3/9] Geary.Util.Logging: Avoid logging any destroyed loggable objects
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/misc-criticals: 3/9] Geary.Util.Logging: Avoid logging any destroyed loggable objects
- Date: Sat, 27 Jun 2020 02:32:30 +0000 (UTC)
commit 16a25870f42928ab153016bb6be3bf82021a84ef
Author: Michael Gratton <mike vee net>
Date: Thu Jun 25 21:00:44 2020 +1000
Geary.Util.Logging: Avoid logging any destroyed loggable objects
Extends the fix for commit 8c43288b to all logging parents as well. Use
a weak ref so we don't try to ref loggable objects that are already
destroyed.
Fixes #875
src/engine/util/util-logging.vala | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/util/util-logging.vala b/src/engine/util/util-logging.vala
index c4c517cde..acfdc97d3 100644
--- a/src/engine/util/util-logging.vala
+++ b/src/engine/util/util-logging.vala
@@ -538,12 +538,14 @@ public interface Geary.Logging.Source : GLib.Object {
va_list args) {
Context context = Context(this.logging_domain, levels, fmt, args);
- // Don't attempt to this object if it is in the middle of
- // being destructed, which can happen when logging from
- // the destructor.
- Source? decorated = (this.ref_count > 0) ? this : this.logging_parent;
+ weak Source? decorated = this;
while (decorated != null) {
- context.append_source(decorated);
+ // Check ref counts of logged objects and don't log them
+ // if they are or have been being destroyed, which can
+ // happen when e.g. logging from the destructor.
+ if (decorated.ref_count > 0) {
+ context.append_source(decorated);
+ }
decorated = decorated.logging_parent;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]