/ Check-in [1ae9f9e4]
Login

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

Overview
Comment:Add SQLITE_OMIT_SHUTDOWN_DIRECTORIES compile-time option to disable clearing the sqlite3_data_directory and sqlite3_temp_directory variables during sqlite3_shutdown. Also, only clear the variables if the heap was actually shutdown.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winrt
Files: files | file ages | folders
SHA1: 1ae9f9e4f730eccbc0fc3408de1ac3c4be931e01
User & Date: mistachkin 2012-03-18 01:32:44
Context
2012-03-18
03:22
On Windows, when no temporary path is available, skip prepending the directory separator. check-in: 32b5c20e user: mistachkin tags: winrt
01:32
Add SQLITE_OMIT_SHUTDOWN_DIRECTORIES compile-time option to disable clearing the sqlite3_data_directory and sqlite3_temp_directory variables during sqlite3_shutdown. Also, only clear the variables if the heap was actually shutdown. check-in: 1ae9f9e4 user: mistachkin tags: winrt
2012-03-16
10:28
Reset the sqlite3_data_directory and sqlite3_temp_directory variables when the sqlite3_shutdown function is called since they may refer to memory allocated by the heap subsystem that was just shutdown. check-in: cd70bc4b user: mistachkin tags: winrt
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

277
278
279
280
281
282
283












284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
  if( sqlite3GlobalConfig.isPCacheInit ){
    sqlite3PcacheShutdown();
    sqlite3GlobalConfig.isPCacheInit = 0;
  }
  if( sqlite3GlobalConfig.isMallocInit ){
    sqlite3MallocEnd();
    sqlite3GlobalConfig.isMallocInit = 0;












  }
  if( sqlite3GlobalConfig.isMutexInit ){
    sqlite3MutexEnd();
    sqlite3GlobalConfig.isMutexInit = 0;
  }

  /* The heap subsystem has now been shutdown and these values are supposed
  ** to be NULL or point to memory that was obtained from sqlite3_malloc(),
  ** which would rely on that heap subsystem; therefore, make sure these
  ** values cannot refer to heap memory that was just invalidated when the
  ** heap subsystem was shutdown.
  */
  sqlite3_data_directory = 0;
  sqlite3_temp_directory = 0;

  return SQLITE_OK;
}

/*
** This API allows applications to modify the global configuration of
** the SQLite library at run-time.
**







>
>
>
>
>
>
>
>
>
>
>
>






<
<
<
<
<
<
<
<
<







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301









302
303
304
305
306
307
308
  if( sqlite3GlobalConfig.isPCacheInit ){
    sqlite3PcacheShutdown();
    sqlite3GlobalConfig.isPCacheInit = 0;
  }
  if( sqlite3GlobalConfig.isMallocInit ){
    sqlite3MallocEnd();
    sqlite3GlobalConfig.isMallocInit = 0;

#ifndef SQLITE_OMIT_SHUTDOWN_DIRECTORIES
    /* The heap subsystem has now been shutdown and these values are supposed
    ** to be NULL or point to memory that was obtained from sqlite3_malloc(),
    ** which would rely on that heap subsystem; therefore, make sure these
    ** values cannot refer to heap memory that was just invalidated when the
    ** heap subsystem was shutdown.  This is only done if the current call to
    ** this function resulted in the heap subsystem actually being shutdown.
    */
    sqlite3_data_directory = 0;
    sqlite3_temp_directory = 0;
#endif
  }
  if( sqlite3GlobalConfig.isMutexInit ){
    sqlite3MutexEnd();
    sqlite3GlobalConfig.isMutexInit = 0;
  }










  return SQLITE_OK;
}

/*
** This API allows applications to modify the global configuration of
** the SQLite library at run-time.
**