Simplified proper cleanup of allocated event filters for swipe handler.

This commit is contained in:
23rd 2025-04-12 19:32:44 +03:00 committed by John Preston
parent d49da1fdd0
commit 667e614bf3

View file

@ -76,7 +76,7 @@ void SetupSwipeHandler(SwipeHandlerArgs &&args) {
bool touch = false; bool touch = false;
}; };
struct State { struct State {
base::unique_qptr<QObject> filterContext; base::unique_qptr<QObject> filter;
Ui::Animations::Simple animationReach; Ui::Animations::Simple animationReach;
Ui::Animations::Simple animationEnd; Ui::Animations::Simple animationEnd;
SwipeContextData data; SwipeContextData data;
@ -376,8 +376,8 @@ void SetupSwipeHandler(SwipeHandlerArgs &&args) {
return base::EventFilterResult::Continue; return base::EventFilterResult::Continue;
}; };
widget->setAttribute(Qt::WA_AcceptTouchEvents); widget->setAttribute(Qt::WA_AcceptTouchEvents);
state->filterContext = base::make_unique_q<QObject>(nullptr); state->filter = base::unique_qptr<QObject>(
base::install_event_filter(state->filterContext.get(), widget, filter); base::install_event_filter(widget, filter));
} }
SwipeBackResult SetupSwipeBack( SwipeBackResult SetupSwipeBack(