System.Data.SQLite
Check-in [673dbbf177]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add another sanity check before returning the connection handle stored via weak reference in the connection pool.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-996d13cd87
Files: files | file ages | folders
SHA1: 673dbbf1772227057c080bb3fba9a8cc2d1ddee8
User & Date: mistachkin 2012-04-29 22:50:21
Context
2012-04-30
16:27
Remove superfluous lock from the static helper methods in the SQLiteBase class. check-in: c593d21c60 user: mistachkin tags: tkt-996d13cd87
2012-04-29
22:50
Add another sanity check before returning the connection handle stored via weak reference in the connection pool. check-in: 673dbbf177 user: mistachkin tags: tkt-996d13cd87
05:00
Remove superfluous using statement. check-in: 0b2bf29623 user: mistachkin tags: tkt-996d13cd87
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteConnectionPool.cs.

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
        Queue<WeakReference> poolQueue = queue.Queue;
        if (poolQueue == null) return null;

        while (poolQueue.Count > 0)
        {
          WeakReference cnn = poolQueue.Dequeue();
          SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
          if ((hdl != null) && !hdl.IsClosed)
          {
            return hdl;
          }
          GC.KeepAlive(hdl);
        }
        return null;
      }







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
        Queue<WeakReference> poolQueue = queue.Queue;
        if (poolQueue == null) return null;

        while (poolQueue.Count > 0)
        {
          WeakReference cnn = poolQueue.Dequeue();
          SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
          if ((hdl != null) && !hdl.IsClosed && !hdl.IsInvalid)
          {
            return hdl;
          }
          GC.KeepAlive(hdl);
        }
        return null;
      }