Skip to content

Commit

Permalink
Firing UIScrollView's scrollViewDidScroll: delegate call from within …
Browse files Browse the repository at this point in the history
…Xaml ScrollViewer's ScrollViewerViewChanged event leads to an AV in Xaml if the delegate removes the UIScrollView from the Xaml UIElement tree. To work around the issue, push the delegate call to a subsequent run of the UI thread.

Fixes microsoft#1865.
  • Loading branch information
jaredhms committed Feb 6, 2017
1 parent 835069e commit 7548ddc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Frameworks/UIKit/UIScrollView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,11 @@ - (void)_refreshOrigin {
[self setNeedsLayout];

if ([self.delegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
[self.delegate scrollViewDidScroll:self];
// NOTE: We have to push this off of the ScrollViewer's callback thread to work around
// issue #1865.
dispatch_async(dispatch_get_main_queue(), ^{
[self.delegate scrollViewDidScroll:self];
});
}
}

Expand Down

0 comments on commit 7548ddc

Please sign in to comment.