Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/blitz-shell/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ pub struct View<Rend: WindowRenderer> {
pub ios_request_redraw: std::cell::Cell<bool>,
}

impl<Rend: WindowRenderer> Drop for View<Rend> {
fn drop(&mut self) {
// Release the renderer's window surface before the window is dropped.
// The renderer may be shared (e.g. provided as a context to user code),
// in which case it can outlive the `View`. A GPU surface must not
// outlive the window/display it is attached to: dropping it after the
// event loop has shut down segfaults on Wayland.
self.renderer.suspend();
}
}

impl<Rend: WindowRenderer> View<Rend> {
pub fn init(
config: WindowConfig<Rend>,
Expand Down
7 changes: 2 additions & 5 deletions packages/dioxus-native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,8 @@ pub fn launch_cfg_with_props<P: Clone + 'static, M: 'static>(
base_color: config.base_color,
alpha_mode: config.alpha_mode,
});
let config = WindowConfig::with_attributes(
Box::new(doc) as _,
renderer.clone(),
config.window_attributes,
);
let config =
WindowConfig::with_attributes(Box::new(doc) as _, renderer, config.window_attributes);

// Create application
let application = DioxusNativeApplication::new(proxy, event_queue, config);
Expand Down
Loading