Hi,
We've seen some browser crashes on iOS because the `bind_state_` object held by OnceCallback is deallocated (at least this is what we think) when calling .Run() (happens
here). Seems to happen "rarely" though and the code branch is frequently hit as it is called at least once for every page load.
Context: We are currently working on a feature that is queuing OnceCallback objects in a vector to run periodic batches of queued tasks (see
code). A task corresponds to a OnceCallback instance.
Moving over the `holder_` to a local holder (
here) seems to work, so I assume that the OnceCallback object itself is allocated. Otherwise if the callback obj was deallocated I would assume that the crash would happen at that moment, before using the `bind_state_` object.
The only possibility I see is that the once callback is run more than once but I don't see how this would be possible as we clear the vector of callbacks after it is iterated.
Maybe there is something wrong in the loop below that is used to run the queue
```
for (auto& completion : fetch_requests_) {
std::move(completion).Run(forms);
}
```
fetch_requests_ is the std::vector of OnceCallback
so, we iterate the callbacks using a reference , move them, run them, then clear the vector. Maybe there is something there that may trigger a rare condition, idk.
Any clue? Are those crashes expected to happen from time to time because of some sort of memory corruption?
Thx!