[hyena] [Hyena.Data.Sqlite] Avoid queueing more cmds when disposed



commit be8686812213b8d494df94a1f85cc2ffdbf20ff0
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sun Aug 15 14:55:31 2010 -0700

    [Hyena.Data.Sqlite] Avoid queueing more cmds when disposed

 .../Hyena.Data.Sqlite/HyenaSqliteConnection.cs     |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/Hyena.Data.Sqlite/Hyena.Data.Sqlite/HyenaSqliteConnection.cs b/Hyena.Data.Sqlite/Hyena.Data.Sqlite/HyenaSqliteConnection.cs
index 846ef04..64b0c70 100644
--- a/Hyena.Data.Sqlite/Hyena.Data.Sqlite/HyenaSqliteConnection.cs
+++ b/Hyena.Data.Sqlite/Hyena.Data.Sqlite/HyenaSqliteConnection.cs
@@ -387,7 +387,11 @@ namespace Hyena.Data.Sqlite
 
             while (true) {
                 lock (command_queue) {
-                    if (transaction_thread == null || Thread.CurrentThread == transaction_thread) {
+                    if (dispose_requested) {
+                        // No point in queueing the command if we're already disposing.
+                        // This helps avoid using the probably-disposed queue_signal below too
+                        return;
+                    } else if (transaction_thread == null || Thread.CurrentThread == transaction_thread) {
                         command_queue.Enqueue (command);
                         args_queue.Enqueue (args);
                         arg_queue.Enqueue (arg);



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