System.Data.SQLite

Check-in [8c76674915]
Login

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

Overview
Comment:Fix yet another set of GC race conditions.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8c76674915f848addbe8eda479e3cd17a8fc576b
User & Date: mistachkin 2012-05-03 15:58:34.766
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
Side-by-Side Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLite3.cs.
279
280
281
282
283
284
285

286
287
288
289
290
291
292
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293







+







        _sql = new SQLiteConnectionHandle(db);
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
      }
      // Bind functions to this connection.  If any previous functions of the same name
      // were already bound, then the new bindings replace the old.
      _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags);
      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void ClearPool()
    {
      SQLiteConnectionPool.ClearPool(_fileName);
    }

Changes to System.Data.SQLite/SQLite3_UTF16.cs.
124
125
126
127
128
129
130

131
132
133
134
135
136
137
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138







+







        if (n > 0) throw new SQLiteException(n, null);

        _sql = new SQLiteConnectionHandle(db);
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
      }
      _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags);
      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
    {
        switch (_datetimeFormat)
        {
            case SQLiteDateFormats.Ticks: