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

Unless SQLITE_OMIT_AUTOINIT is defined, allow sqlite3_vfs_unregister() to be called before sqlite3_initialize().

FossilOrigin-Name: ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a
This commit is contained in:
dan
2018-06-13 11:41:54 +00:00
parent 466ea9b1e2
commit 45f318275e
3 changed files with 12 additions and 9 deletions

View File

@@ -410,9 +410,12 @@ int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
** Unregister a VFS so that it is no longer accessible.
*/
int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
MUTEX_LOGIC(sqlite3_mutex *mutex;)
#ifndef SQLITE_OMIT_AUTOINIT
int rc = sqlite3_initialize();
if( rc ) return rc;
#endif
MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
sqlite3_mutex_enter(mutex);
vfsUnlink(pVfs);
sqlite3_mutex_leave(mutex);