From 31ddb3c2d44be014fa9bbb9480cb6226f3cbd1c9 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 10 Sep 2024 13:15:43 +0200 Subject: [PATCH] OGR_GPKG_FillArrowArray_Step(): more rigourous locking to perhaps fix random failure on ogr_gpkg.py::test_ogr_gpkg_arrow_stream_huge_array[huge_string] --- ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp index e7ff2e33561c..f159000a522c 100644 --- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp +++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp @@ -7805,12 +7805,13 @@ void OGR_GPKG_FillArrowArray_Step(sqlite3_context *pContext, int /*argc*/, const int SQLITE_MAX_FUNCTION_ARG = sqlite3_limit(psFillArrowArray->hDB, SQLITE_LIMIT_FUNCTION_ARG, -1); begin: - const int iFeat = [psFillArrowArray]() + int iFeat; + OGRArrowArrayHelper *psHelper; { std::unique_lock oLock(psFillArrowArray->oMutex); - return psFillArrowArray->nCountRows; - }(); - auto psHelper = psFillArrowArray->psHelper.get(); + iFeat = psFillArrowArray->nCountRows; + psHelper = psFillArrowArray->psHelper.get(); + } int iCol = 0; const int iFieldStart = sqlite3_value_int(argv[iCol]); ++iCol;