SQLite

Check-in [7047ce32a2]
Login

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

Overview
Comment:Add a missing mutex around calls to clear the KeyInfo cache when closing a database connection.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7047ce32a234484b8ba15311e6560aa74ff692c9
User & Date: drh 2014-12-08 18:08:45.076
Context
2014-12-08
20:20
Add missing mutex calls around a call to sqlite3SchemaGet() within sqlite3_open(). (check-in: 4541589954 user: dan tags: trunk)
18:08
Add a missing mutex around calls to clear the KeyInfo cache when closing a database connection. (check-in: 7047ce32a2 user: drh tags: trunk)
17:45
Add a missing mutex around calls to clear the KeyInfo cache when closing a database connection. (check-in: 3ddc7e4c77 user: drh tags: branch-3.8.7)
2014-12-06
14:56
Avoid accessing a single uninitialized byte when moving a rare 3-byte cell from an internal page to a leaf. This was not actually causing a problem, just a valgrind warning. (check-in: 6aeece19a2 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
1030
1031
1032
1033
1034
1035
1036

1037
1038
1039
1040
1041

1042
1043
1044
1045
1046
1047
1048

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){
      if( pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */

        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }

      }
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 ){
        pDb->pSchema = 0;
      }
    }







>





>







1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){
      if( pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
        sqlite3BtreeEnter(pDb->pBt);
        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }
        sqlite3BtreeLeave(pDb->pBt);
      }
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 ){
        pDb->pSchema = 0;
      }
    }