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

Ensure ASControlMode properties lock before accessing their ivars #1476

Merged
merged 1 commit into from
May 1, 2019
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
5 changes: 5 additions & 0 deletions Source/ASControlNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#pragma once

#pragma clang diagnostic push
#pragma clang diagnostic error "-Wobjc-missing-property-synthesis"

NS_ASSUME_NONNULL_BEGIN

/**
Expand Down Expand Up @@ -147,3 +150,5 @@ static UIControlState const ASControlStateSelected ASDISPLAYNODE_DEPRECATED_MSG(
#endif

NS_ASSUME_NONNULL_END

#pragma clang diagnostic pop
63 changes: 63 additions & 0 deletions Source/ASControlNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ @interface ASControlNode ()
// Control Attributes
BOOL _enabled;
BOOL _highlighted;
BOOL _selected;

// Tracking
BOOL _tracking;
Expand Down Expand Up @@ -121,6 +122,68 @@ - (void)__exitHierarchy
}
}

#pragma mark - ASDisplayNode Overrides

- (BOOL)isEnabled
{
ASLockScopeSelf();
return _enabled;
}

- (void)setEnabled:(BOOL)enabled
{
ASLockScopeSelf();
_enabled = enabled;
}

- (BOOL)isHighlighted
{
ASLockScopeSelf();
return _highlighted;
}

- (void)setHighlighted:(BOOL)highlighted
{
ASLockScopeSelf();
_highlighted = highlighted;
}

- (void)setSelected:(BOOL)selected
{
ASLockScopeSelf();
_selected = selected;
}

- (BOOL)isSelected
{
ASLockScopeSelf();
return _selected;
}

- (void)setTracking:(BOOL)tracking
{
ASLockScopeSelf();
_tracking = tracking;
}

- (BOOL)isTracking
{
ASLockScopeSelf();
return _tracking;
}

- (void)setTouchInside:(BOOL)touchInside
{
ASLockScopeSelf();
_touchInside = touchInside;
}

- (BOOL)isTouchInside
{
ASLockScopeSelf();
return _touchInside;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"

Expand Down