[TIMOB-11719] iOS: App crashes when firing an Event with cyclic data
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Won't Fix |
| Resolution Date | 2013-03-26T02:58:44.000+0000 |
| Affected Version/s | Release 2.1.3, Release 3.0.0 |
| Fix Version/s | 2013 Sprint 07 Core, 2013 Sprint 07 |
| Components | iOS |
| Labels | triage |
| Reporter | Moritz Roessler |
| Assignee | Max Stepanov |
| Created | 2012-10-31T07:44:33.000+0000 |
| Updated | 2017-03-22T21:37:23.000+0000 |
Description
*Problem description*
When pressing the button in the code, the app crashes and closes. This is on iOS only. It works fine on Android.
*Test case*
var win = Ti.UI.createWindow({
title:"Cyclic Test"
})
var button = Ti.UI.createButton({
title:"Fire event"
});
button.addEventListener("click",function(){
var cyclic = {
b: {
a:"A"
}
}
cyclic.b.parent = cyclic
Ti.App.fireEvent("cyclic",cyclic)
})
win.add(button)
win.open()
Tested and confirmed iOS 5.1 TiSDK 2.1.3 GA, 3.0.0 CI. Not reproducible on Android 2.3.4 device. Did you try this on Android and/or iOS?
I tried this only on Ios devices
Cyclic structures are not JSON serializable and "fireEvent" does serialization of argument (on iOS at least :) ). Not sure this bug is valid.
The cyclic data in parameters is not supported on both platforms. The following code crashes on iOS and Android.
var win = Ti.UI.createWindow({ title:"Cyclic Test" }) var button = Ti.UI.createButton({ title:"Fire event" }); button.addEventListener("click",function(){ var cyclic = { b: { a:"A" } } cyclic.b.parent = cyclic; Ti.App.fireSystemEvent(Ti.App.EVENT_ACCESSIBILITY_ANNOUNCEMENT,cyclic) }) win.add(button) win.open();Closing ticket as "Won't Fix".