diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Gpu/GlCalculatorHelper.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Gpu/GlCalculatorHelper.cs index ae91a9c3f..abc27f1c9 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Gpu/GlCalculatorHelper.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Gpu/GlCalculatorHelper.cs @@ -50,7 +50,7 @@ public Status RunInGlContext(GlStatusFunction glStatusFunc) { Status tmpStatus = null; - NativeGlStatusFunction nativeGlStatusFunc = () => + var status = RunInGlContext(() => { try { @@ -61,11 +61,7 @@ public Status RunInGlContext(GlStatusFunction glStatusFunc) tmpStatus = Status.FailedPrecondition(e.ToString()); } return tmpStatus.mpPtr; - }; - - var nativeGlStatusFuncHandle = GCHandle.Alloc(nativeGlStatusFunc, GCHandleType.Pinned); - var status = RunInGlContext(nativeGlStatusFunc); - nativeGlStatusFuncHandle.Free(); + }); if (tmpStatus != null) { tmpStatus.Dispose(); }