Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

maicki
Copy link
Contributor

@maicki maicki commented May 4, 2016

Currently in a race condition situation it can happen that subnodes get transition ids from supernodes where the supernodes transition id was reset but the subnode still has the old transition id value. This will trigger an exception although the assignment of the transition id is totally valid. This PR should address this by not reseting the transition id at all for a node and increase the transition id for new transitions.

cc @nguyenhuy @appleguy @levi

@ghost ghost added the CLA Signed label May 4, 2016
@levi
Copy link
Contributor

levi commented May 5, 2016

Really great stuff, @maicki! I can imagine this wasn't easy to find.

return _transitionSentinel == nil || transitionID != _transitionSentinel.value;
}

return YES;
Copy link
Contributor

@nguyenhuy nguyenhuy May 5, 2016

Choose a reason for hiding this comment

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

Maybe this is a bit better?

- (BOOL)_shouldAbortTransitionWithID:(int32_t)transitionID
{
  ASDN::MutexLocker l(_propertyLock);
  return !_transitionInProgress || _transitionSentinel == nil || transitionID != _transitionSentinel.value;
}

@maicki
Copy link
Contributor Author

maicki commented May 6, 2016

@appleguy @nguyenhuy Addressed comments from @nguyenhuy

  • Move from ASSentinel to atomic int
  • Better return statement for "_shouldAbortTransitionWithID"

if ([self _hasTransitionsInProgress]) {
// Invalidate transition sentinel to cancel transitions in progress
[self _invalidateTransitionSentinel];
if ([self _hasTransitionInProgress]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Both of these names are more clear than they were before. Thanks!

@appleguy
Copy link
Contributor

appleguy commented May 7, 2016

@maicki amazing investigatory work here! It's a testament to your understanding of the code that the lines changed is relatively small.

@appleguy appleguy merged commit c3ae0d7 into facebookarchive:master May 7, 2016
@appleguy appleguy added this to the 1.9.8 milestone May 7, 2016
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this pull request Sep 23, 2019
* Simplify code logic

* Keep using user-defined type
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants