From c4394b5bb36da92e07d4f48f975285b631f1b0c8 Mon Sep 17 00:00:00 2001 From: James Welch Date: Thu, 18 Jul 2024 09:28:54 -0500 Subject: [PATCH] ObjC Blocks: Fix SIGSEV in test where panic was expected. --- objc/objc_block_darwin_test.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/objc/objc_block_darwin_test.go b/objc/objc_block_darwin_test.go index f1973eb5..d9278627 100644 --- a/objc/objc_block_darwin_test.go +++ b/objc/objc_block_darwin_test.go @@ -147,17 +147,12 @@ func TestBlockCopyAndBlockRelease(t *testing.T) { t.Parallel() refCount := 0 - defer func() { - if refCount != 0 { - t.Fatalf("refCount: %d != 0", refCount) - } - }() - block := objc.NewBlock( func(objc.Block) { refCount++ }, ) + defer block.Release() refCount++ copies := make([]objc.Block, 17) @@ -184,13 +179,4 @@ func TestBlockCopyAndBlockRelease(t *testing.T) { if refCount != 1 { t.Fatalf("refCount: %d != 1", refCount) } - block.Release() - refCount-- - - defer func() { - if recover() == nil { - t.Fatal("Block.Release(): function was not released on refCount == 0") - } - }() - block.Invoke() }