[geary/wip/imap-db-acccount-test-flakey: 1/4] Close thread pool if present in Geary.Database dtor



commit 92bca47d435e64031dc0424a162be9569e22c88e
Author: Michael Gratton <mike vee net>
Date:   Tue Jan 22 00:45:30 2019 +1100

    Close thread pool if present in Geary.Database dtor
    
    Fixes running unit tests on a single CPU host.

 src/engine/db/db-database.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/db/db-database.vala b/src/engine/db/db-database.vala
index 90f8f5c2..a13a8777 100644
--- a/src/engine/db/db-database.vala
+++ b/src/engine/db/db-database.vala
@@ -84,9 +84,9 @@ public class Geary.Db.Database : Geary.Db.Context {
     }
 
     ~Database() {
-        // Not thrilled about using lock in a dtor
-        lock (outstanding_async_jobs) {
-            assert(outstanding_async_jobs == 0);
+        // Not thrilled about long-running tasks in a dtor
+        if (this.thread_pool != null) {
+            GLib.ThreadPool.free((owned) this.thread_pool, true, true);
         }
     }
 


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