Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl: do not set to null the surface and target at touch_on_up() #720

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

clopez
Copy link
Contributor

@clopez clopez commented Jul 18, 2024

On a multitouch screen, when several fingers are on the screen at the same time, if we set to null surface and target on touch_on_up() then we stop all the ongoing touch gestures and not only the one of the finger that caused the up event. That is becasue touch_on_motion() will refuse to process further events if surface or target are null.

Instead of doing that do not set to null this pointers on the touch_on_up() event. The value of those will be set again on the next touch_on_down() event in any case.

Related: #698
Related: https://bugs.webkit.org/show_bug.cgi?id=270516

Copy link
Member

@psaavedra psaavedra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

Copy link
Member

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to make seat->touch_target a weak reference, that way if the CogViewport gets destroyed before the touch-move and/or touch-up events arrive it will be set to NULL automatically and we avoid use-after-free of a stale pointer.

When assigning inside touch_on_down we want to use:

-    seat->touch_target = viewport;
+    g_set_weak_pointer(&seat->touch_target, viewport);

platform/wayland/cog-platform-wl.c Show resolved Hide resolved
On a multitouch screen, when several fingers are on the screen at
the same time, if we set to null surface and target on touch_on_up()
then we stop all the ongoing touch gestures and not only the one
of the finger that caused the up event. That is becasue
touch_on_motion() will refuse to process further events if surface
or target are null.

Instead of doing that do not set to null this pointers on the
touch_on_up() event. The value of those will be set again on
the next touch_on_down() event in any case.

Also make seat->touch_target a weak reference, that way if the
CogViewport gets destroyed before the touch-move and/or touch-up
events arrive it will be set to NULL automatically and we avoid
use-after-free of a stale pointer.

Related: Igalia#698
Related: https://bugs.webkit.org/show_bug.cgi?id=270516
@clopez
Copy link
Contributor Author

clopez commented Aug 27, 2024

changed: make seat->touch_target a weak reference

@clopez clopez requested a review from aperezdc August 27, 2024 09:32
@aperezdc aperezdc merged commit edafaa0 into Igalia:master Aug 27, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants