[macos] Avoid panic when callback is None.

This can happen when window is destroyed/created during a call to user
callback as this causes WindowDelegate method to be called.

Instead if the user callback is `None` store the event in
`pending_events`.
This commit is contained in:
mitchmindtree 2017-03-19 19:09:20 +11:00
parent 4b39f81621
commit 41e7572147
2 changed files with 42 additions and 14 deletions

View file

@ -57,7 +57,7 @@ impl WindowDelegate {
};
if let Some(events_loop) = state.events_loop.upgrade() {
events_loop.user_callback.call_with_event(event);
events_loop.call_user_callback_with_event_or_store_in_pending(event);
}
}