System.Data.SQLite
Check-in [8c76674915]
Not logged in

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

Overview
Comment:Fix yet another set of GC race conditions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8c76674915f848addbe8eda479e3cd17a8fc576b
User & Date: mistachkin 2012-05-03 15:58:34
Context
2012-05-03
16:44
Expand scope for the GC.KeepAlive call in the SQLiteConnectionPool.Add method. check-in: d13b6a5885 user: mistachkin tags: trunk
15:58
Fix yet another set of GC race conditions. check-in: 8c76674915 user: mistachkin tags: trunk
15:11
Fix a couple more potential GC race conditions. check-in: ed16f61cf7 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   279    279           _sql = new SQLiteConnectionHandle(db);
   280    280           lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
   281    281         }
   282    282         // Bind functions to this connection.  If any previous functions of the same name
   283    283         // were already bound, then the new bindings replace the old.
   284    284         _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags);
   285    285         SetTimeout(0);
          286  +      GC.KeepAlive(_sql);
   286    287       }
   287    288   
   288    289       internal override void ClearPool()
   289    290       {
   290    291         SQLiteConnectionPool.ClearPool(_fileName);
   291    292       }
   292    293   

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

   124    124           if (n > 0) throw new SQLiteException(n, null);
   125    125   
   126    126           _sql = new SQLiteConnectionHandle(db);
   127    127           lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
   128    128         }
   129    129         _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags);
   130    130         SetTimeout(0);
          131  +      GC.KeepAlive(_sql);
   131    132       }
   132    133   
   133    134       internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
   134    135       {
   135    136           switch (_datetimeFormat)
   136    137           {
   137    138               case SQLiteDateFormats.Ticks: