mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-30 23:27:22 +00:00
linuxkms: Avoid keeping the EGL display around for too long
Don't keep a strong reference to the EGL display, we don't need that. If the display is removed but there are pending events, just ignore them.
This commit is contained in:
parent
388661cc53
commit
b998f94ad6
1 changed files with 7 additions and 4 deletions
|
@ -63,15 +63,18 @@ impl super::Presenter for EglDisplay {
|
|||
self: Rc<Self>,
|
||||
event_loop_handle: crate::calloop_backend::EventLoopHandle,
|
||||
) -> Result<calloop::RegistrationToken, PlatformError> {
|
||||
let self_weak = Rc::downgrade(&self);
|
||||
crate::calloop_backend::FileDescriptorActivityNotifier::new(
|
||||
&event_loop_handle,
|
||||
calloop::Interest::READ,
|
||||
self.gbm_device.0.clone(),
|
||||
Box::new(move || {
|
||||
for event in self.gbm_device.receive_events().unwrap() {
|
||||
if matches!(event, drm::control::Event::PageFlip(..)) {
|
||||
*self.page_flip_state.borrow_mut() = PageFlipState::ReadyForNextBuffer;
|
||||
break;
|
||||
if let Some(this) = self_weak.upgrade() {
|
||||
for event in this.gbm_device.receive_events().unwrap() {
|
||||
if matches!(event, drm::control::Event::PageFlip(..)) {
|
||||
*this.page_flip_state.borrow_mut() = PageFlipState::ReadyForNextBuffer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue