Ensured proper cleanup of allocated event filters for swipe handler.

This commit is contained in:
23rd 2025-03-24 22:19:15 +03:00
parent 0d085d500f
commit 4e4c69993c

View file

@ -76,7 +76,7 @@ void SetupSwipeHandler(SwipeHandlerArgs &&args) {
bool touch = false; bool touch = false;
}; };
struct State { struct State {
base::unique_qptr<QObject> filter; base::unique_qptr<QObject> filterContext;
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->filter = base::make_unique_q<QObject>( state->filterContext = base::make_unique_q<QObject>(nullptr);
base::install_event_filter(widget, filter)); base::install_event_filter(state->filterContext.get(), widget, filter);
} }
SwipeBackResult SetupSwipeBack( SwipeBackResult SetupSwipeBack(