-
Notifications
You must be signed in to change notification settings - Fork 6k
Conditionally call FlutterViewDestroyOverlaySurfaces #31464
Conversation
bool needsLayer; | ||
{ | ||
std::lock_guard lock(layers_mutex_); | ||
needsLayer = available_layer_index_ >= layers_.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any risk that the layers_
list may be modified between this check and the time when the layer is used?
The lock may need to be held during the entire operation. Or it may need an approach such as:
- with the lock held:
- obtain a layer if available and remove it from
layers_
- obtain a layer if available and remove it from
- if no layer was available, then create a layer
- with the lock held:
- set up the layer and insert it into
layers_
- set up the layer and insert it into
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it in 117787a, so the lock is held during the entire operation. PTAL
DestroyLayersUnsafe(jni_facade); | ||
} | ||
|
||
void SurfacePool::DestroyLayersUnsafe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the suffix Locked
for this API instead of Unsafe
. This method is safe as long as the caller holds the lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
e951c61
to
c0bb667
Compare
* Conditionally call FlutterViewDestroyOverlaySurfaces (#31464) * Fix PhysicalShapeLayer paint bounds with clipping disabled (#31656) * Fix PhysicalShapeLayer paint bounds with clipping disabled * Add missing SkRect initialization * 'add branch flutter-2.8-candidate.16 to enabled_branches in .ci.yaml' * remove branch ref Co-authored-by: Emmanuel Garcia <[email protected]> Co-authored-by: Matej Knopp <[email protected]>
Fixes flutter/flutter#98530
On Android, the external view embedder may post a task to the platform
thread, and wait until it completes if overlay surfaces must be released during
application startup.
However, the platform thread might be blocked when Dart is initializing.