Skip to content

Commit

Permalink
Fix crash when destroying window
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopengli89 committed Jun 7, 2023
1 parent 8f7f3ef commit 49126d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- On Web, `EventLoopProxy` now implements `Send`.
- On Web, `Window` now implements `Send` and `Sync`.
- **Breaking:** `WindowExtWebSys::canvas()` now returns an `Option`.
- On macOS, fix crash when dropping `Window`.

# 0.28.6

Expand Down
4 changes: 3 additions & 1 deletion src/platform_impl/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ declare_class!(
fn draw_rect(&mut self, rect: NSRect) {
trace_scope!("drawRect:");

AppState::handle_redraw(self.window_id());
if let Some(window) = self._ns_window.load() {
AppState::handle_redraw(WindowId(window.id()));
}

#[allow(clippy::let_unit_value)]
unsafe {
Expand Down

0 comments on commit 49126d1

Please sign in to comment.