mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Keep winit::Window alive until all rendering contexts are destroyed
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
c94605b13e
commit
603289d1aa
2 changed files with 10 additions and 2 deletions
|
@ -42,13 +42,17 @@ pub struct App {
|
||||||
preferences: Preferences,
|
preferences: Preferences,
|
||||||
servoshell_preferences: ServoShellPreferences,
|
servoshell_preferences: ServoShellPreferences,
|
||||||
suspended: Cell<bool>,
|
suspended: Cell<bool>,
|
||||||
windows: HashMap<WindowId, Rc<dyn WindowPortsMethods>>,
|
|
||||||
minibrowser: Option<Minibrowser>,
|
minibrowser: Option<Minibrowser>,
|
||||||
waker: Box<dyn EventLoopWaker>,
|
waker: Box<dyn EventLoopWaker>,
|
||||||
initial_url: ServoUrl,
|
initial_url: ServoUrl,
|
||||||
t_start: Instant,
|
t_start: Instant,
|
||||||
t: Instant,
|
t: Instant,
|
||||||
state: AppState,
|
state: AppState,
|
||||||
|
|
||||||
|
// This is the last field of the struct to ensure that windows are dropped *after* all other
|
||||||
|
// references to the relevant rendering contexts have been destroyed.
|
||||||
|
// (https://github.com/servo/servo/issues/36711)
|
||||||
|
windows: HashMap<WindowId, Rc<dyn WindowPortsMethods>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Action to be taken by the caller of [`App::handle_events`].
|
/// Action to be taken by the caller of [`App::handle_events`].
|
||||||
|
|
|
@ -49,7 +49,6 @@ use crate::desktop::keyutils::CMD_OR_CONTROL;
|
||||||
use crate::prefs::ServoShellPreferences;
|
use crate::prefs::ServoShellPreferences;
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
winit_window: winit::window::Window,
|
|
||||||
screen_size: Size2D<u32, DeviceIndependentPixel>,
|
screen_size: Size2D<u32, DeviceIndependentPixel>,
|
||||||
inner_size: Cell<PhysicalSize<u32>>,
|
inner_size: Cell<PhysicalSize<u32>>,
|
||||||
toolbar_height: Cell<Length<f32, DeviceIndependentPixel>>,
|
toolbar_height: Cell<Length<f32, DeviceIndependentPixel>>,
|
||||||
|
@ -72,6 +71,11 @@ pub struct Window {
|
||||||
/// The `RenderingContext` of Servo itself. This is used to render Servo results
|
/// The `RenderingContext` of Servo itself. This is used to render Servo results
|
||||||
/// temporarily until they can be blitted into the egui scene.
|
/// temporarily until they can be blitted into the egui scene.
|
||||||
rendering_context: Rc<OffscreenRenderingContext>,
|
rendering_context: Rc<OffscreenRenderingContext>,
|
||||||
|
|
||||||
|
// Keep this as the last field of the struct to ensure that the rendering context is
|
||||||
|
// dropped first.
|
||||||
|
// (https://github.com/servo/servo/issues/36711)
|
||||||
|
winit_window: winit::window::Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue