[geary/cherry-pick-19a655bc] Merge branch 'mjog/650-old-val-0-glib-critical' into 'mainline'



commit 7a56d074546f2ead59397a97b07035df043267e2
Author: Michael Gratton <mike vee net>
Date:   Wed Mar 25 07:48:07 2020 +0000

    Merge branch 'mjog/650-old-val-0-glib-critical' into 'mainline'
    
    Geary.Util.Source: Fix GLib `old_val > 0` critical
    
    Closes #650
    
    See merge request GNOME/geary!455
    
    (cherry picked from commit 19a655bc6aad0a210e3b36c50572acb304d1336a)
    
    8c43288b Geary.Util.Logging.Source: Fix GLib `old_val > 0` critical

 src/engine/util/util-logging.vala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/engine/util/util-logging.vala b/src/engine/util/util-logging.vala
index 4161aad7..05f8234d 100644
--- a/src/engine/util/util-logging.vala
+++ b/src/engine/util/util-logging.vala
@@ -219,7 +219,10 @@ public interface Geary.Logging.Source : GLib.Object {
                                        va_list args) {
         if (flags == ALL || Logging.get_flags().is_any_set(flags)) {
             Context context = Context(Logging.DOMAIN, flags, levels, fmt, args);
-            Source? decorated = this;
+            // 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;
             while (decorated != null) {
                 context.append_source(decorated);
                 decorated = decorated.logging_parent;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]