Status of problem 34412

Hello, I have reported a bug 34412 almost 3 weeks ago I would like to know if it was successfully reproduced or not and if there are estimations when it will be fixed.

After waiting some time I released my game with workaround, but I would like to fix this.

Thanks

Hi @hayk,

I took a quick look at your code, and it looks like you’re seriously “overloading” the system in your implementation. First, you’re using the “onEvent” listener for the button, but you’re not filtering/checking for which phase, so the button is effectively trying to load the scene on dozens/hundreds of touch “moved” responses if the user drags the touch on the button at all. Second (and most importantly), you’re not filtering which touch (of the multitouch) should be triggering the button… when using multitouch, you need to carefully manage which finger is the “active” one for certain tasks.

Most likely, if you correct these things in your code, the crash will stop occurring.

Best regards,

Brent

Hello,

Overloading is not a problem, because when you comment out line which enables multitouch it works without problem.

Filtering which touch will not help, because it crashes even corona simulator which does not have second touch

Regards, 

Hayk

More info on bug:

When I changed callback 

onEvent = function(event)     if (event.phase == "began") then        Composer.gotoScene("settings");     end end

it still crashed with multitouch enabled, but when filtered everything but “ended” phase it worked.

Hope this helps

I have more info, but not sure 100%. It seems that bug is somewhere around setFocus and multitouch.

When I tried to implement button like corona’s button as a workaround it started to crash too after I added setFocus call on began. 

Hi @hayk,

It’s the multitouch which is overloading the system. You’re basically telling every touch to trigger the scene load. I suggest that you isolate the first touch and ignore the others. This is pretty much necessary any time you’re dealing with multitouch.

Take care,

Brent

When I am handling onEvent like you are suggesting

onEvent = function(event)     if (event.phase == "began") then        Composer.gotoScene("settings");     end end

it still crashes

You also need to handle which touch ID should be handled. On that note, do you really need multitouch enabled for this button scene? Why not just activate it during the game scenes or whenever it’s actually used?

Brent

Hello,

Yes I really need multitouch for button scene and I can even give good explanation why I need it, but even if I do not need multitiouch it does not change the fact that there is a valid code that crashed corona SDK simulator and binaries created by Corona SDK.

I spend some more time (which I don’t like to do) and narrowed problem down to this:

widget = require("widget"); system.activate("multitouch"); local parentsButton = widget.newButton({     width = 260,     height = 90,     defaultFile = "assets/btn1.png",     overFile = "assets/btn2.png",     onEvent = function(event)         if (event.phase == "began") then             event.target:removeSelf();         end     end }); parentsButton.x = display.contentCenterX; parentsButton.y = display.contentCenterY;

just run this code in main.lua and it will crash 1 time out of 3.

about handling touch ID: I assume that widget library handles touchID-s and if not there should be a big red note about it in docs.

Event assuming that widgets don’t support touch ID handling it will look like this 

widget = require("widget"); system.activate("multitouch"); local touchID = nil; local parentsButton = widget.newButton({     width = 260,     height = 90,     defaultFile = "assets/btn1.png",     overFile = "assets/btn2.png",     onEvent = function(event)         if (event.phase == "began") then touchID = event.id;             event.target:removeSelf();         end -- Bunch of code comparing touchID and event.id which does not matter because it crashed in code above     end }); parentsButton.x = display.contentCenterX; parentsButton.y = display.contentCenterY;

also there is just a single click because it is simulator and I am using single finger when app crashes :slight_smile:

if this helps here is stack of crash

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0   com.coronalabs.Corona_Simulator 0x00000001022adbb3 0x1021d9000 + 871347

1   com.coronalabs.Corona_Simulator 0x00000001022adc50 0x1021d9000 + 871504

2   com.coronalabs.Corona_Simulator 0x00000001022738f4 0x1021d9000 + 633076

3   com.coronalabs.Corona_Simulator 0x00000001022740ff 0x1021d9000 + 635135

4   com.coronalabs.Corona_Simulator 0x00000001022928d5 0x1021d9000 + 760021

5   com.coronalabs.Corona_Simulator 0x00000001021ecacc 0x1021d9000 + 80588

6   com.apple.AppKit               0x00007fff909fc145 -[NSWindow sendEvent:] + 781

7   com.apple.AppKit               0x00007fff9099d5d4 -[NSApplication sendEvent:] + 2021

8   com.apple.AppKit               0x00007fff907ed9f9 -[NSApplication run] + 646

9   com.apple.AppKit               0x00007fff907d8783 NSApplicationMain + 940

10  com.coronalabs.Corona_Simulator 0x00000001021dafd4 start + 52

I can not narrow it down even more because I don’t have source codes of Corona SDK.

Hi @hayk,

Please try removing that “nested” function from the widget constructor, and pull it outside like is shown in our example code. Also, instead of using “onEvent”, try using the “onPress” or “onRelease” option.

Thanks,

Brent

Hi @hayk,

I took a quick look at your code, and it looks like you’re seriously “overloading” the system in your implementation. First, you’re using the “onEvent” listener for the button, but you’re not filtering/checking for which phase, so the button is effectively trying to load the scene on dozens/hundreds of touch “moved” responses if the user drags the touch on the button at all. Second (and most importantly), you’re not filtering which touch (of the multitouch) should be triggering the button… when using multitouch, you need to carefully manage which finger is the “active” one for certain tasks.

Most likely, if you correct these things in your code, the crash will stop occurring.

Best regards,

Brent

Hello,

Overloading is not a problem, because when you comment out line which enables multitouch it works without problem.

Filtering which touch will not help, because it crashes even corona simulator which does not have second touch

Regards, 

Hayk

More info on bug:

When I changed callback 

onEvent = function(event)     if (event.phase == "began") then        Composer.gotoScene("settings");     end end

it still crashed with multitouch enabled, but when filtered everything but “ended” phase it worked.

Hope this helps

I have more info, but not sure 100%. It seems that bug is somewhere around setFocus and multitouch.

When I tried to implement button like corona’s button as a workaround it started to crash too after I added setFocus call on began. 

Hi @hayk,

It’s the multitouch which is overloading the system. You’re basically telling every touch to trigger the scene load. I suggest that you isolate the first touch and ignore the others. This is pretty much necessary any time you’re dealing with multitouch.

Take care,

Brent

When I am handling onEvent like you are suggesting

onEvent = function(event)     if (event.phase == "began") then        Composer.gotoScene("settings");     end end

it still crashes

You also need to handle which touch ID should be handled. On that note, do you really need multitouch enabled for this button scene? Why not just activate it during the game scenes or whenever it’s actually used?

Brent

Hello,

Yes I really need multitouch for button scene and I can even give good explanation why I need it, but even if I do not need multitiouch it does not change the fact that there is a valid code that crashed corona SDK simulator and binaries created by Corona SDK.

I spend some more time (which I don’t like to do) and narrowed problem down to this:

widget = require("widget"); system.activate("multitouch"); local parentsButton = widget.newButton({     width = 260,     height = 90,     defaultFile = "assets/btn1.png",     overFile = "assets/btn2.png",     onEvent = function(event)         if (event.phase == "began") then             event.target:removeSelf();         end     end }); parentsButton.x = display.contentCenterX; parentsButton.y = display.contentCenterY;

just run this code in main.lua and it will crash 1 time out of 3.

about handling touch ID: I assume that widget library handles touchID-s and if not there should be a big red note about it in docs.

Event assuming that widgets don’t support touch ID handling it will look like this 

widget = require("widget"); system.activate("multitouch"); local touchID = nil; local parentsButton = widget.newButton({     width = 260,     height = 90,     defaultFile = "assets/btn1.png",     overFile = "assets/btn2.png",     onEvent = function(event)         if (event.phase == "began") then touchID = event.id;             event.target:removeSelf();         end -- Bunch of code comparing touchID and event.id which does not matter because it crashed in code above     end }); parentsButton.x = display.contentCenterX; parentsButton.y = display.contentCenterY;

also there is just a single click because it is simulator and I am using single finger when app crashes :slight_smile:

if this helps here is stack of crash

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0   com.coronalabs.Corona_Simulator 0x00000001022adbb3 0x1021d9000 + 871347

1   com.coronalabs.Corona_Simulator 0x00000001022adc50 0x1021d9000 + 871504

2   com.coronalabs.Corona_Simulator 0x00000001022738f4 0x1021d9000 + 633076

3   com.coronalabs.Corona_Simulator 0x00000001022740ff 0x1021d9000 + 635135

4   com.coronalabs.Corona_Simulator 0x00000001022928d5 0x1021d9000 + 760021

5   com.coronalabs.Corona_Simulator 0x00000001021ecacc 0x1021d9000 + 80588

6   com.apple.AppKit               0x00007fff909fc145 -[NSWindow sendEvent:] + 781

7   com.apple.AppKit               0x00007fff9099d5d4 -[NSApplication sendEvent:] + 2021

8   com.apple.AppKit               0x00007fff907ed9f9 -[NSApplication run] + 646

9   com.apple.AppKit               0x00007fff907d8783 NSApplicationMain + 940

10  com.coronalabs.Corona_Simulator 0x00000001021dafd4 start + 52

I can not narrow it down even more because I don’t have source codes of Corona SDK.

Hi @hayk,

Please try removing that “nested” function from the widget constructor, and pull it outside like is shown in our example code. Also, instead of using “onEvent”, try using the “onPress” or “onRelease” option.

Thanks,

Brent