-
Notifications
You must be signed in to change notification settings - Fork 6k
Always use fml::TaskRunnerAffineWeakPtr for SnapshotDelegate #36772
Conversation
Capturing from Discord for future code archeologists: the issue here was object slicing. Since the |
Shouldn't that copy constructor be deleted to prevent future issues? |
|
Isn't From Discord it sounded like the longer-term plan was to make |
|
Yes - given how these classes work I don't think it makes sense for I have a patch in progress that fixes this. |
Maybe copying makes sense for base WeakPtr objects, but it shouldn't be inherited through the subclass that imposes additional constraints. It sounds like this is being addressed though. |
Constructing a WeakPtr from a TaskRunnerAffineWeakPtr is undesirable because the resulting WeakPtr will get default WeakPtr thread checking behavior. See flutter#36772
Fixes flutter/flutter#113437
I hope someone who knows C++ better can explain this to me, I would not have expected this to cause problems (maybe it's related to unopt builds? it can only show up in an unopt build).
What's happening before this patch is that when threads get merged, the checks from
fml::WeakPtrare getting used instead offml::TaskRunnerAffineWeakPtr, which is whatSnapshotDelegateis. I don't get why the upcast causes that.@stuartmorgan fyi