@@ -370,7 +370,7 @@ Result<std::shared_ptr<HeifPixelImage>> ImageItem_Grid::decode_full_grid_image(c
370370 }
371371 }
372372
373- err = decode_and_paste_tile_image (tileID, x0, y0, img, options, progress_counter);
373+ err = decode_and_paste_tile_image (tileID, x0, y0, img, options, progress_counter, warnings );
374374 if (err) {
375375 return err;
376376 }
@@ -418,7 +418,7 @@ Result<std::shared_ptr<HeifPixelImage>> ImageItem_Grid::decode_full_grid_image(c
418418 errs.push_back (std::async (std::launch::async,
419419 &ImageItem_Grid::decode_and_paste_tile_image, this ,
420420 data.tileID , data.x_origin , data.y_origin , std::ref (img), options,
421- std::ref (progress_counter)));
421+ std::ref (progress_counter), std::ref (warnings) ));
422422 }
423423
424424 // check for decoding errors in remaining tiles
@@ -464,19 +464,23 @@ static Error progress_and_return_ok(const heif_decoding_options& options, int& p
464464Error ImageItem_Grid::decode_and_paste_tile_image (heif_item_id tileID, uint32_t x0, uint32_t y0,
465465 std::shared_ptr<HeifPixelImage>& inout_image,
466466 const heif_decoding_options& options,
467- int & progress_counter) const
467+ int & progress_counter, std::vector<Error>& warnings ) const
468468{
469469 std::shared_ptr<HeifPixelImage> tile_img;
470+ #if ENABLE_PARALLEL_TILE_DECODING
471+ static std::mutex warningsMutex;
472+ #endif
470473
471474 auto tileItem = get_context ()->get_image (tileID, true );
472475 if (!tileItem && !options.strict_decoding ) {
473476 // We ignore missing images.
474- if (inout_image) {
475- inout_image->add_warning (Error{
476- heif_error_Invalid_input,
477- heif_suberror_Missing_grid_images,
478- });
479- }
477+ #if ENABLE_PARALLEL_TILE_DECODING
478+ std::lock_guard<std::mutex> lock (warningsMutex);
479+ #endif
480+ warnings.push_back (Error{
481+ heif_error_Invalid_input,
482+ heif_suberror_Missing_grid_images,
483+ });
480484 return progress_and_return_ok (options, progress_counter);
481485 }
482486
@@ -489,12 +493,13 @@ Error ImageItem_Grid::decode_and_paste_tile_image(heif_item_id tileID, uint32_t
489493 if (!decodeResult) {
490494 if (!options.strict_decoding ) {
491495 // We ignore broken tiles.
492- if (inout_image) {
493- inout_image->add_warning (Error{
494- heif_error_Invalid_input,
495- heif_suberror_Missing_grid_images,
496- });
497- }
496+ #if ENABLE_PARALLEL_TILE_DECODING
497+ std::lock_guard<std::mutex> lock (warningsMutex);
498+ #endif
499+ warnings.push_back (Error{
500+ heif_error_Invalid_input,
501+ heif_suberror_Missing_grid_images,
502+ });
498503 return progress_and_return_ok (options, progress_counter);
499504 }
500505
0 commit comments