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

Multitouch input crashes Avalonia app on Raspberry Pi 4B / Linux (arm-x64) #14249

Closed
lubomirtrubac opened this issue Jan 17, 2024 · 7 comments
Closed
Labels
bug help-wanted A contribution from the community would be most welcome. os-linux

Comments

@lubomirtrubac
Copy link

lubomirtrubac commented Jan 17, 2024

Describe the bug

Application with some dummy button (no event wired), hold with two fingers for a couple of seconds, sometimes needs more than one try. Application crashes to console with unhandled System.NullReferenceException. Tried on Raspbian x64 Lite using DRM and Raspbian x64 with full desktop - behavior is the same.

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at Avalonia.Input.Gestures.PointerReleased(RoutedEventArgs ev)
at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value)
at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
at Avalonia.Input.TouchDevice.ProcessRawEvent(RawInputEventArgs ev)
at Avalonia.RawEventGrouper.Dispatch(RawInputEventArgs ev)
at Avalonia.Controls.Platform.ManagedDispatcherImpl.RunLoop(CancellationToken token)
at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at LinuxFramebufferPlatformExtensions.StartLinuxDirect(AppBuilder builder, String[] args, IOutputBackend outputBackend, IInputBackend inputBackend)
at ARTRA.Dochadzka.Terminal.Desktop.Program.Main(String[] args)

To Reproduce

Steps to reproduce the behavior:

  1. Follow steps to run Avalonia App on Raspberry Pi at: https://docs.avaloniaui.net/docs/guides/platforms/rpi/running-on-raspbian-lite-via-drm
  2. Add a dummy button to the main view
  3. Run application
  4. Touch that button repeatedly with 2+ fingers
  5. Application crashes

Expected behavior

Application should stay open

Environment

  • OS: Linux - Raspbian x64 Lite / full with desktop
  • Avalonia-Version: 11.0.7
  • HW: Raspberry Pi 4B 8GB
@maxkatz6
Copy link
Member

maxkatz6 commented Jan 17, 2024

Should be fixed in the master: https://github.com/AvaloniaUI/Avalonia/pull/14140/files
Please try nightly builds.

@lubomirtrubac
Copy link
Author

Thank you for your advice. No, it is not fixed in nightly builds, I have tried:
11.0.999-cibuild0043664-beta
11.1.999-cibuild0043666-beta
Both behave the same - using 2+ touches simultaneously and holding for a couple of seconds repeatedly crashes the app, now without any stacktrace info, just straight to console.

11.0.999
This version behaves a little differently - application just freezes and does not respond anymore.

@maxkatz6 maxkatz6 added help-wanted A contribution from the community would be most welcome. os-linux labels Jan 18, 2024
@lsoft
Copy link

lsoft commented Mar 22, 2024

Looks like we see the same problem.

@lubomirtrubac does any workaround found?

@pkstrsk
Copy link

pkstrsk commented Mar 23, 2024

We are also experiencing the same problem, latest version of Avalonia.
Edit: Raspberry 5

@zabolotnev
Copy link
Contributor

@maxkatz6 The problem is in Gestures.PointerReleased. In some cases value s_lastHeldPointer is null and s_isHolding is true. It looks like some kind of race condition, or unexpected order of calls. Anyway it causes NRE. I'll try to submit a PR today.

zabolotnev added a commit to zabolotnev/Avalonia that referenced this issue Mar 25, 2024
@lubomirtrubac
Copy link
Author

@lsoft @pkstrsk Hello, unfortunately no - I did not even try to find a solution, because I had to implement other parts of the app first.
@zabolotnev Thank you for finding a solution. Hope it will be solved in upcomming release of Avalonia.

zabolotnev added a commit to zabolotnev/Avalonia that referenced this issue Mar 25, 2024
zabolotnev added a commit to zabolotnev/Avalonia that referenced this issue Mar 26, 2024
zabolotnev added a commit to zabolotnev/Avalonia that referenced this issue Mar 29, 2024
maxkatz6 pushed a commit that referenced this issue Apr 5, 2024
* refs #14249 Avoid NullReferenceException in Gestures.PointerReleased

* refs #14249 Track current gesture state with single readonly struct

* Update from review

* Moved the last click location from the GestureState record to a separate field. (#14249)

---------

Co-authored-by: Заболотнев Юрий <zabolotnev@promit-ek.ru>
@maxkatz6
Copy link
Member

maxkatz6 commented Apr 5, 2024

Fixed by #15117

@maxkatz6 maxkatz6 closed this as completed Apr 5, 2024
maxkatz6 pushed a commit that referenced this issue Apr 6, 2024
* refs #14249 Avoid NullReferenceException in Gestures.PointerReleased

* refs #14249 Track current gesture state with single readonly struct

* Update from review

* Moved the last click location from the GestureState record to a separate field. (#14249)

---------

Co-authored-by: Заболотнев Юрий <zabolotnev@promit-ek.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome. os-linux
Projects
None yet
Development

No branches or pull requests

5 participants