mirror of
https://github.com/servo/servo
synced 2026-05-12 18:06:32 +02:00
Remove `Painter`s from the `Compositor` when their final `WebView` is dropped. This ensures that their resources are properly released and deinitialized, such as the WebRender instance and all of its resources. Without this change, these things leak. This change requires the ability to handle inexistant `Painter`s during message handling, as messages from other parts of the `Constellation` for a `Painter` can arrive after it has been released. We don't really need to do this for `Compositor` API calls because they are triggered via the `WebView`. When a `WebView` is alive its `Painter` should always also be alive, so the `expect()` call still makes sense in that case. Part of this also involves removing the redundant `RemoveWebView` message to the `Compositor`. This is handled now in the `WebView` `Drop` implementation for both simplicity and necessity. Testing: This should not change observable behavior, but does fix a memory leak while closing windows. Signed-off-by: Martin Robinson <mrobinson@igalia.com>