Greetings,

We ran into a bug that's not documented behavior: closing a connection that
was created in a different thread (where thread A calls sqlite3_open[16],
"hands off" the connection to thread B, and thread B calls sqlite3_close). 

The documentation (http://www.sqlite.org/faq.html#q6) says that any
functions can be used with a connection as long as it's not being used by
another thread. With SQLITE_ENABLE_MEMORY_MANAGEMENT defined, the cleanup
code in sqlite3PagerClose triggers a NULL exception, since the
thread-specific pager list for the second thread hasn't been used: 

  if( pPager==pTsd->pPager ){
    pTsd->pPager = pPager->pNext;
  }else{
    Pager *pTmp;
    for(pTmp = pTsd->pPager; pTmp->pNext!=pPager; pTmp=pTmp->pNext){}
    pTmp->pNext = pPager->pNext;
  }

In our tests, pTsd->pPager was NULL, so dereferencing pTmp (pTmp->pNext) is
the problem. This may be fixed in 3.5; we're using 3.4.2.

-- 
View this message in context: 
http://www.nabble.com/Bug%3A-Database-connection-closed-on-different-thread-tf4558261.html#a13008373
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to