From e0c3f342b9bb74681988698739a257c4388a1370 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 10 Jun 2024 10:48:23 +0200 Subject: [PATCH 1/2] don't resize if the surface is deleted --- .../android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp b/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp index ba93735ece..d429664942 100644 --- a/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +++ b/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp @@ -78,6 +78,11 @@ void RNSkOpenGLCanvasProvider::surfaceSizeChanged(int width, int height) { return; } + if (_surfaceHolder == nullptr) { + // No surface holder, nothing to do + return; + } + // Recreate RenderContext surface based on size change??? _surfaceHolder->resize(width, height); From 3610396a60523e4ed917b8f788624b079739c072 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 10 Jun 2024 12:57:07 +0200 Subject: [PATCH 2/2] Address threading issues in registerView --- package/cpp/rnskia/RNSkJsiViewApi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/cpp/rnskia/RNSkJsiViewApi.h b/package/cpp/rnskia/RNSkJsiViewApi.h index 54343db101..280f936ff8 100644 --- a/package/cpp/rnskia/RNSkJsiViewApi.h +++ b/package/cpp/rnskia/RNSkJsiViewApi.h @@ -313,9 +313,9 @@ class RNSkJsiViewApi : public RNJsi::JsiHostObject, * @return The callback info object for the requested view */ RNSkViewInfo *getEnsuredViewInfo(size_t nativeId) { + std::lock_guard lock(_mutex); if (_viewInfos.count(nativeId) == 0) { RNSkViewInfo info; - std::lock_guard lock(_mutex); _viewInfos.emplace(nativeId, info); } return &_viewInfos.at(nativeId);