Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use node lock instead of separate one to avoid deadlocks. #582

Merged
merged 2 commits into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## master

* Add your own contributions to the next release on the line below this with your name.
- [ASNetworkImageNode] Fix deadlock in GIF handling. [#582](https://github.com/TextureGroup/Texture/pull/582) [Garrett Moon](https://github.com/garrettmoon)
- [ASDisplayNode] Add attributed versions of a11y label, hint and value. [#554](https://github.com/TextureGroup/Texture/pull/554) [Alexander Hüllmandel](https://github.com/fruitcoder)
- [ASCornerRounding] Introduce .cornerRoundingType: CALayer, Precomposited, or Clip Corners. [Scott Goodson](https://github.com/appleguy) [#465](https://github.com/TextureGroup/Texture/pull/465)
- [Yoga] Add insertYogaNode:atIndex: method. Improve handling of relayouts. [Scott Goodson](https://github.com/appleguy)
Expand Down
19 changes: 10 additions & 9 deletions Source/ASImageNode+AnimatedImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import <AsyncDisplayKit/ASAssert.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkSubclasses.h>
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
#import <AsyncDisplayKit/ASEqualityHelpers.h>
#import <AsyncDisplayKit/ASImageNode+Private.h>
Expand All @@ -43,7 +44,7 @@ @implementation ASImageNode (AnimatedImage)

- (void)setAnimatedImage:(id <ASAnimatedImageProtocol>)animatedImage
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_setAnimatedImage:animatedImage];
}

Expand Down Expand Up @@ -85,13 +86,13 @@ - (void)animatedImageSet:(id <ASAnimatedImageProtocol>)newAnimatedImage previous

- (id <ASAnimatedImageProtocol>)animatedImage
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
return _animatedImage;
}

- (void)setAnimatedImagePaused:(BOOL)animatedImagePaused
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);

_animatedImagePaused = animatedImagePaused;

Expand All @@ -100,13 +101,13 @@ - (void)setAnimatedImagePaused:(BOOL)animatedImagePaused

- (BOOL)animatedImagePaused
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
return _animatedImagePaused;
}

- (void)setCoverImageCompleted:(UIImage *)coverImage
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_setCoverImageCompleted:coverImage];
}

Expand All @@ -123,7 +124,7 @@ - (void)_locked_setCoverImageCompleted:(UIImage *)coverImage

- (void)setCoverImage:(UIImage *)coverImage
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_setCoverImage:coverImage];
}

Expand Down Expand Up @@ -161,7 +162,7 @@ - (void)setAnimatedImageRunLoopMode:(NSString *)runLoopMode

- (void)setShouldAnimate:(BOOL)shouldAnimate
{
ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_setShouldAnimate:shouldAnimate];
}

Expand Down Expand Up @@ -194,7 +195,7 @@ - (void)startAnimating
{
ASDisplayNodeAssertMainThread();

ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_startAnimating];
}

Expand Down Expand Up @@ -233,7 +234,7 @@ - (void)stopAnimating
{
ASDisplayNodeAssertMainThread();

ASDN::MutexLocker l(_animatedImageLock);
ASDN::MutexLocker l(__instanceLock__);
[self _locked_stopAnimating];
}

Expand Down
1 change: 0 additions & 1 deletion Source/Private/ASImageNode+AnimatedImagePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ extern NSString *const ASAnimatedImageDefaultRunLoopMode;

@interface ASImageNode ()
{
ASDN::RecursiveMutex _animatedImageLock;
ASDN::Mutex _displayLinkLock;
id <ASAnimatedImageProtocol> _animatedImage;
BOOL _animatedImagePaused;
Expand Down