Skip to content

Commit

Permalink
fix: no need to pin callbacks (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Feb 22, 2022
1 parent 6e60f75 commit 0dafc8a
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Status RunInGlContext(GlStatusFunction glStatusFunc)
{
Status tmpStatus = null;

NativeGlStatusFunction nativeGlStatusFunc = () =>
var status = RunInGlContext(() =>
{
try
{
Expand All @@ -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(); }

Expand Down

0 comments on commit 0dafc8a

Please sign in to comment.