1056/1058 [Probably Before, But Noticed It Now] - Duplicate "began" Touch Events For The Same Touch Id!

Today we’ve discovered, that when mashing fast on a touch enabled object [with multitouch enabled], we can get multiple “began” touch events with the same touch id.

Funny thing, only one ended phase.

 

We’ve submitted a bug already, but just wanted to see if others had similar issues.

 

It’s possible to get this error on iOS and Android.

 

Here’s a sample code I used to test it:

 

system.activate("multitouch") local grp = display.newGroup() local rect = display.newRect(50, 50, 50, 50) local touch rect:addEventListener("touch", function(event) print("Event phase: " .. event.phase .. " event id: " .. tostring(event.id)) if event.phase == "began" then if touch ~= nil then print("IT HAPPENED!!!!") end touch = event.id elseif event.phase == "ended" and event.id == touch then touch = nil end end)

 

When you mash very fast you will eventually get the “IT HAPPENED” log and you will see two began events with same id.

Unfortunately the example I’ve provided is too basic to fully show what was going on with my code.

Of course the problem was on my side. I’ve got two objects one on the other [to work around touch detection issue on Sony Xperia Arc] and one is setting focus on the second one. Unfortunately, after I set the focus I wasn’t returning true, this caused two began phases on my listener. After adding return true it started to work fine.

Unfortunately the example I’ve provided is too basic to fully show what was going on with my code.

Of course the problem was on my side. I’ve got two objects one on the other [to work around touch detection issue on Sony Xperia Arc] and one is setting focus on the second one. Unfortunately, after I set the focus I wasn’t returning true, this caused two began phases on my listener. After adding return true it started to work fine.