diff options
author | saturneric <[email protected]> | 2024-01-16 03:49:50 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-16 03:49:50 +0000 |
commit | 4994f4eaa1211d402b791660ad6221154a4c2405 (patch) | |
tree | c3f0cdc0008849de79c6bd8030c0c65c5d02f9f3 /src/core/function/gpg/GpgContext.cpp | |
parent | fix: slove a heap-use-after-free problem (diff) | |
download | GpgFrontend-4994f4eaa1211d402b791660ad6221154a4c2405.tar.gz GpgFrontend-4994f4eaa1211d402b791660ad6221154a4c2405.zip |
fix: make task and threading system safer
Diffstat (limited to 'src/core/function/gpg/GpgContext.cpp')
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index bc0787a4..0849f240 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -221,8 +221,9 @@ class GpgContext::Impl { gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_GPGCONF, args.custom_gpgconf_path.toUtf8(), nullptr); - assert(CheckGpgError(err) == GPG_ERR_NO_ERROR); if (CheckGpgError(err) != GPG_ERR_NO_ERROR) { + GF_CORE_LOG_ERROR("set gpg context engine info error: {}", + DescribeGpgErrCode(err).second); return false; } } @@ -275,7 +276,9 @@ class GpgContext::Impl { auto binary_ctx_initialize(const GpgContextInitArgs &args) -> bool { gpgme_ctx_t p_ctx; - if (CheckGpgError(gpgme_new(&p_ctx)) != GPG_ERR_NO_ERROR) { + if (auto err = CheckGpgError(gpgme_new(&p_ctx)); err != GPG_ERR_NO_ERROR) { + GF_CORE_LOG_ERROR("get new gpg context error: {}", + DescribeGpgErrCode(err).second); return false; } assert(p_ctx != nullptr); |