xamarin-docs icon indicating copy to clipboard operation
xamarin-docs copied to clipboard

Multi-Touch Effect - Crash on Android Platform

Open BelightWavre opened this issue 2 years ago • 0 comments

Hello,

Sorry, I'm new to contribute to Xamarin Doc. So I prefer to open an issue and let you check this. Don't hesitate to give my feed back !

I encouter some crashes on Android platform. In some circumstances, the Id already exists in the idToEffectDictionary dictionary while an new Down ou PointerDown event is fired (with the same id than an existing one) ... ! So I add some Key checking before insertion (see bold lines below).

It solves the problem and I didn't see any backside effect up to now. Any better idee or comment ?

                case MotionEventActions.Down:
                case MotionEventActions.PointerDown:
                    FireEvent(this, id, TouchActionType.Pressed, screenPointerCoords, true);

                   // Added by Belight on 2021/11/03
                    **if (idToEffectDictionary.ContainsKey(id)) 
                        idToEffectDictionary[id] = this;

                    else**
                    // End of addition
                        idToEffectDictionary.Add(id, this);  // Memorises the id of the touch within the effect who "receive" it

                    capture = libTouchEffect.Capture;
                    break;

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

BelightWavre avatar Nov 03 '21 10:11 BelightWavre