Skip to content

Commit 8dd7231

Browse files
committed
wip
1 parent 1f11f49 commit 8dd7231

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/platform/macos/view.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use super::keyboard::{make_modifiers, KeyboardState};
44
use super::window::WindowSharedState;
55
use crate::handler::WindowHandlerBuilder;
66
use crate::platform::*;
7+
use crate::tracing::warn;
78
use crate::wrappers::appkit::*;
89
use crate::MouseEvent::{ButtonPressed, ButtonReleased};
910
use crate::{
@@ -182,7 +183,10 @@ impl BaseviewView {
182183
}
183184

184185
fn trigger_frame(this: ViewRef<Self>) {
185-
this.window_handler.use_handler(|h| h.on_frame());
186+
if let Some(Err(e)) = this.window_handler.use_handler(|h| h.on_frame()) {
187+
warn!("Error while rendering frame: {}", e);
188+
Self::close(this);
189+
}
186190
}
187191
}
188192

@@ -226,12 +230,18 @@ impl ViewImpl for BaseviewView {
226230
if this.state.scale_factor.get() != current_scale_factor
227231
|| this.state.size.get() != current_size
228232
{
229-
this.state.size.set(current_size);
233+
let previous = this.state.size.replace(current_size);
230234
this.state.scale_factor.set(current_scale_factor);
231235

232-
this.window_handler.use_handler(|h| {
236+
let result = this.window_handler.use_handler(|h| {
233237
h.resized(WindowSize::from_logical(current_size, current_scale_factor))
234238
});
239+
240+
if let Some(Err(e)) = result {
241+
warn!("Window Handler failed to resize: {}", e);
242+
this.state.size.set(previous);
243+
Self::resize(this, previous.into())
244+
}
235245
}
236246
}
237247

0 commit comments

Comments
 (0)