mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-02 16:47:24 +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>,
|
self: Rc<Self>,
|
||||||
event_loop_handle: crate::calloop_backend::EventLoopHandle,
|
event_loop_handle: crate::calloop_backend::EventLoopHandle,
|
||||||
) -> Result<calloop::RegistrationToken, PlatformError> {
|
) -> Result<calloop::RegistrationToken, PlatformError> {
|
||||||
|
let self_weak = Rc::downgrade(&self);
|
||||||
crate::calloop_backend::FileDescriptorActivityNotifier::new(
|
crate::calloop_backend::FileDescriptorActivityNotifier::new(
|
||||||
&event_loop_handle,
|
&event_loop_handle,
|
||||||
calloop::Interest::READ,
|
calloop::Interest::READ,
|
||||||
self.gbm_device.0.clone(),
|
self.gbm_device.0.clone(),
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
for event in self.gbm_device.receive_events().unwrap() {
|
if let Some(this) = self_weak.upgrade() {
|
||||||
if matches!(event, drm::control::Event::PageFlip(..)) {
|
for event in this.gbm_device.receive_events().unwrap() {
|
||||||
*self.page_flip_state.borrow_mut() = PageFlipState::ReadyForNextBuffer;
|
if matches!(event, drm::control::Event::PageFlip(..)) {
|
||||||
break;
|
*this.page_flip_state.borrow_mut() = PageFlipState::ReadyForNextBuffer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue