-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(ios): Do not call setNeedsLayout() when another layout update request is in process #9875
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
Conversation
… validation issues.
Let me point out this problem never occured in versions older than 8.2. |
@dimitrisrk when you say older than 8.2 you are talking about the runtime or the core? |
It seems it's core-specific. |
@dimitrisrk ok so if you say it was not happening with core 8.1 we should theorically be able to find the culprit commit |
I managed to find the culprit and it seems the problem is deeper than it looks. I have a list-view with items that also contain icons (using Image element which makes use of GC during disposal), and a popup view that has sorting options for this list. Visual sorting is performed by sorting an ObservableArray of items. ListView gets notified for So, after I attempt to sort my list about 2-3 times, my app will throw the error posted above. @NathanWalker I'm not sure why, but it seems iOS garbage collector has trouble when multiple image views are to be disposed which is my case. If I comment out code inside |
@dimitrisrk you call |
I use original |
ok so i think it could be good to test with the jsc runtime. it could be v8 related. |
Perhaps. Few commits ago, GC was performed more often and a recent fix made it less frequent (I think problem starts there). What I found so far: Changing disposeImageSource() {
var _a, _b, _c;
if (((_a = this.nativeViewProtected) === null || _a === void 0 ? void 0 : _a.image) === ((_b = this.imageSource) === null || _b === void 0 ? void 0 : _b.ios)) {
this.nativeViewProtected.image = null;
}
if ((_c = this.imageSource) === null || _c === void 0 ? void 0 : _c.ios) {
this.imageSource.ios = null;
}
this.imageSource = null;
queueGC(1); // Delay of 1 ms
} |
@dimitrisrk lets decrease it to 1ms there - if you pr’d that we can put up an alpha that we can put against few projects next couple days and if good universally we can publish patch with that. Makes sense the delay should be less there. Could also include it in this PR. |
a GC call shouldn't crash your app. If it does then we have some underlying issue. It might be that the view that's calculating the layout has been removed from the view tree and the GC call collected the native view from it, in which case there should be a guard around that. |
I agree with @edusperoni. Changing the delay does not seem like the right fix. We need to find the real source of the issue |
I've been doing more tests since last night and I'm also suspecting it's related to a garbage-collected view. I believe such issues should give more priority to solving the problem related to _tearDownUI patch for iOS, since I suspect the incomplete view lifecycle may have also played an importart role in this case. |
PR Checklist
What is the current behavior?
There are cases that a layout contains children that often get updated because of bindings.
In my case, it was a list of GridLayouts with nested images, the visibility of which was changing through user interactivity.
Upon 2-3 uses, my app was crashing with an assertion failed message:
What is the new behavior?
I concluded that an additional
setNeedsLayout
call was causing this crash in my app.My patch checks if a layout update has already been requested, and prevents pointless
setNeedsLayout
calls.Runtime version: 8.2
Core version: 8.2