From 5b8107e9c209e5f630ffeb83c97b4c4250cfc85e Mon Sep 17 00:00:00 2001 From: Jackson Gardner Date: Tue, 9 Apr 2024 10:25:18 -0700 Subject: [PATCH] [skwasm] Reify the SkPicture pointer as the right type. (flutter/engine#51991) When recreating this `unique_ptr`, we need to ensure it matches the type in `Surface::renderPictures` which is released. See here: ``` std::unique_ptr[]> picturePointers = std::make_unique[]>(count); for (int i = 0; i < count; i++) { picturePointers[i] = sk_ref_sp(pictures[i]); } // Releasing picturePointers here and will recreate the unique_ptr on the // other thread See surface_renderPicturesOnWorker skwasm_dispatchRenderPictures(_thread, this, picturePointers.release(), count, callbackId); ``` --- engine/src/flutter/lib/web_ui/skwasm/surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/lib/web_ui/skwasm/surface.cpp b/engine/src/flutter/lib/web_ui/skwasm/surface.cpp index 7567335f3f..e91d343a50 100644 --- a/engine/src/flutter/lib/web_ui/skwasm/surface.cpp +++ b/engine/src/flutter/lib/web_ui/skwasm/surface.cpp @@ -259,8 +259,8 @@ SKWASM_EXPORT void surface_renderPicturesOnWorker(Surface* surface, uint32_t callbackId, double rasterStart) { // This will release the pictures when they leave scope. - std::unique_ptr> picturesPointer = - std::unique_ptr>(pictures); + std::unique_ptr[]> picturesPointer = + std::unique_ptr[]>(pictures); surface->renderPicturesOnWorker(pictures, pictureCount, callbackId, rasterStart); }