diff options
| author | Alan D. Snow <alansnow21@gmail.com> | 2020-08-19 08:02:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-19 15:02:42 +0200 |
| commit | 84713021edf688c9cf157562d34388583325aa45 (patch) | |
| tree | 6a1694de8df49fb68a66e74c02e5f8750a0c0e78 /src | |
| parent | 62ad09fe02c4a67e727822134768e4ebe6c8cde4 (diff) | |
| download | PROJ-84713021edf688c9cf157562d34388583325aa45.tar.gz PROJ-84713021edf688c9cf157562d34388583325aa45.zip | |
Clone projCppContext context when copying projCtx_t (#2324)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ctx.cpp | 7 | ||||
| -rw-r--r-- | src/iso19111/c_api.cpp | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index 1e97e58a..930ae9ea 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -24,6 +24,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 #include <errno.h> #include <stdlib.h> @@ -34,6 +37,7 @@ #include "proj_experimental.h" #include "proj_internal.h" #include "filemanager.hpp" +#include "proj/internal/io_internal.hpp" /************************************************************************/ /* pj_get_ctx() */ @@ -152,6 +156,9 @@ projCtx_t::projCtx_t(const projCtx_t& other) file_finder_user_data = other.file_finder_user_data; networking = other.networking; ca_bundle_path = other.ca_bundle_path; + if (other.cpp_context != nullptr) { + cpp_context = other.cpp_context->clone(this); + } } /************************************************************************/ diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 9219f767..947be058 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -125,6 +125,18 @@ projCppContext::toVector(const char *const *auxDbPaths) { // --------------------------------------------------------------------------- +projCppContext* projCppContext::clone(PJ_CONTEXT *ctx) const { + projCppContext* newContext = new projCppContext( + ctx, + getDbPath().c_str(), + getAuxDbPaths() + ); + newContext->setAutoCloseDb(getAutoCloseDb()); + return newContext; +} + +// --------------------------------------------------------------------------- + void projCppContext::closeDb() { databaseContext_ = nullptr; } // --------------------------------------------------------------------------- |
