From 590840d6ff03090edb71ba6f9ad26c3a1c4e95e2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 2 Jun 2021 21:15:18 +0200 Subject: factory.cpp: preparation steps for global sqlite3* handle, but no functional change --- src/malloc.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/malloc.cpp') diff --git a/src/malloc.cpp b/src/malloc.cpp index 6b7fbf26..4727f478 100644 --- a/src/malloc.cpp +++ b/src/malloc.cpp @@ -180,4 +180,5 @@ void proj_cleanup() { FileManager::clearMemoryCache(); pj_clear_hgridshift_knowngrids_cache(); pj_clear_vgridshift_knowngrids_cache(); + pj_clear_sqlite_cache(); } -- cgit v1.2.3 From 85512dd3a782cf04520fe11b645de8e4ef42932d Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 3 Jun 2021 11:29:56 +0200 Subject: proj_cleanup(): make sure it frees the database context of the default PJ_CONTEXT --- src/malloc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/malloc.cpp') diff --git a/src/malloc.cpp b/src/malloc.cpp index 4727f478..d60a3f92 100644 --- a/src/malloc.cpp +++ b/src/malloc.cpp @@ -33,6 +33,9 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#ifndef FROM_PROJ_CPP +#define FROM_PROJ_CPP +#endif /* allocate and deallocate memory */ /* These routines are used so that applications can readily replace @@ -46,6 +49,8 @@ #include +#include "proj/internal/io_internal.hpp" + #include "proj.h" #include "proj_internal.h" #include "grids.hpp" @@ -176,6 +181,13 @@ PJ *pj_default_destructor (PJ *P, int errlev) { /* Destructor */ /*****************************************************************************/ void proj_cleanup() { /*****************************************************************************/ + + // Close the database context of the default PJ_CONTEXT + auto cpp_context = pj_get_default_ctx()->cpp_context; + if( cpp_context ) { + cpp_context->closeDb(); + } + pj_clear_initcache(); FileManager::clearMemoryCache(); pj_clear_hgridshift_knowngrids_cache(); -- cgit v1.2.3