Fix panic when destroying window (#2773)
* Fix crash when destroying window * Add a comment to draw_rect --------- Co-authored-by: Xiaopeng Li <lixiaopeng.jetspark@bytedance.com>
This commit is contained in:
parent
0c8bf25ae4
commit
07d39abddd
2 changed files with 5 additions and 1 deletions
|
|
@ -243,7 +243,10 @@ declare_class!(
|
|||
fn draw_rect(&mut self, rect: NSRect) {
|
||||
trace_scope!("drawRect:");
|
||||
|
||||
AppState::handle_redraw(self.window_id());
|
||||
// It's a workaround for https://github.com/rust-windowing/winit/issues/2640, don't replace with `self.window_id()`.
|
||||
if let Some(window) = self._ns_window.load() {
|
||||
AppState::handle_redraw(WindowId(window.id()));
|
||||
}
|
||||
|
||||
#[allow(clippy::let_unit_value)]
|
||||
unsafe {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue