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

Avoid setting frame on a node's backing store while holding its lock #1048

Merged
merged 1 commit into from
Jul 24, 2018

Conversation

nguyenhuy
Copy link
Member

Doing so may trigger -layer:didChangeBoundsWithOldValue:newValue: on the layer's delegate (i.e ASCALayerExtendedDelegate) which then runs other operations that require the lock to be free.

1
2

Doing so may trigger `-layer:didChangeBoundsWithOldValue:newValue:` on the layer's delegate (i.e `ASCALayerExtendedDelegate`) which then runs other operations that require the lock to be free.
@ghost
Copy link

ghost commented Jul 24, 2018

🚫 CI failed with log

@ghost
Copy link

ghost commented Jul 24, 2018

1 Warning
⚠️ Any source code changes should have an entry in CHANGELOG.md or have #trivial in their title.

Generated by 🚫 Danger


if (setToView) {
ASDisplayNodeAssertTrue(nodeLoaded && isMainThread);
_view.frame = rect;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may should grab the _view and _layer with the lock held?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those properties are only modified on main, and since this is on main thread, we can avoid locking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also -isNodeLoaded.

@nguyenhuy nguyenhuy merged commit 95de2ab into TextureGroup:master Jul 24, 2018
@nguyenhuy nguyenhuy deleted the HN-Set-Frame-Without-Lock branch July 24, 2018 22:03
nguyenhuy added a commit to nguyenhuy/Texture that referenced this pull request Jul 24, 2018
…extureGroup#1048)

Doing so may trigger `-layer:didChangeBoundsWithOldValue:newValue:` on the layer's delegate (i.e `ASCALayerExtendedDelegate`) which then runs other operations that require the lock to be free.
mikezucc pushed a commit to mikezucc/Texture that referenced this pull request Oct 2, 2018
…extureGroup#1048)

Doing so may trigger `-layer:didChangeBoundsWithOldValue:newValue:` on the layer's delegate (i.e `ASCALayerExtendedDelegate`) which then runs other operations that require the lock to be free.
wiseoldduck pushed a commit to wiseoldduck/Texture that referenced this pull request Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants