1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

The sqlite3_close() interface returns SQLITE_OK even if there are outstanding

sqlite3_stmt and sqlite3_backup objects.  The connection becomes a zombie.
Resource deallocation is deferred until the last sqlite3_stmt or 
sqlite3_backup object closes.  This is intended to help SQLite play nicer
with garbage collectors.

FossilOrigin-Name: e276a02b7f54e804caa553dca99023416a415e1c
This commit is contained in:
drh
2012-06-02 14:32:21 +00:00
parent ed46682719
commit 4245c405ea
12 changed files with 84 additions and 75 deletions

View File

@@ -71,17 +71,12 @@ int sqlite3_finalize(sqlite3_stmt *pStmt){
}else{
Vdbe *v = (Vdbe*)pStmt;
sqlite3 *db = v->db;
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex;
#endif
if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT;
#if SQLITE_THREADSAFE
mutex = v->db->mutex;
#endif
sqlite3_mutex_enter(mutex);
sqlite3_mutex_enter(db->mutex);
rc = sqlite3VdbeFinalize(v);
if( (rc&0xff)==SQLITE_MISUSE ) rc = SQLITE_OK;
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(mutex);
sqlite3LeaveMutexAndCloseZombie(db);
}
return rc;
}