mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Make extra calls to sqlite3_shutdown() be harmless no-ops. (CVS 6520)
FossilOrigin-Name: d80822953c2d2f2fd7f6acdd3caa403c0decacc4
This commit is contained in:
22
src/main.c
22
src/main.c
@@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.537 2009/04/17 16:54:23 drh Exp $
|
||||
** $Id: main.c,v 1.538 2009/04/19 12:23:58 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -213,18 +213,22 @@ int sqlite3_initialize(void){
|
||||
** Undo the effects of sqlite3_initialize(). Must not be called while
|
||||
** there are outstanding database connections or memory allocations or
|
||||
** while any part of SQLite is otherwise in use in any thread. This
|
||||
** routine is not threadsafe. Not by a long shot.
|
||||
** routine is not threadsafe. But it is safe to invoke this routine
|
||||
** on when SQLite is already shut down. If SQLite is already shut down
|
||||
** when this routine is invoked, then this routine is a harmless no-op.
|
||||
*/
|
||||
int sqlite3_shutdown(void){
|
||||
sqlite3GlobalConfig.isMallocInit = 0;
|
||||
sqlite3PcacheShutdown();
|
||||
if( sqlite3GlobalConfig.isInit ){
|
||||
sqlite3_os_end();
|
||||
sqlite3GlobalConfig.isMallocInit = 0;
|
||||
sqlite3PcacheShutdown();
|
||||
if( sqlite3GlobalConfig.isInit ){
|
||||
sqlite3_os_end();
|
||||
}
|
||||
sqlite3_reset_auto_extension();
|
||||
sqlite3MallocEnd();
|
||||
sqlite3MutexEnd();
|
||||
sqlite3GlobalConfig.isInit = 0;
|
||||
}
|
||||
sqlite3_reset_auto_extension();
|
||||
sqlite3MallocEnd();
|
||||
sqlite3MutexEnd();
|
||||
sqlite3GlobalConfig.isInit = 0;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user