Skip to content

Instantly share code, notes, and snippets.

@dodikk
Created October 4, 2012 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dodikk/3833722 to your computer and use it in GitHub Desktop.
Save dodikk/3833722 to your computer and use it in GitHub Desktop.
Changing the struct after block copy
-(void)testStructChangeAndBlocks
{
SDRefreshTraits traits_ = { YES, NO };
__block BOOL forceRefresh_ = NO;
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
};
block_ = [ block_ copy ];
traits_.forceRefresh = NO;
[ self performAsyncRequestOnMainThreadWithBlock: block_
selector: _cmd ];
GHAssertTrue( forceRefresh_, @"block does not handle C struct properly" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment