Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11719] iOS: App crashes when firing an Event with cyclic data

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2013-03-26T02:58:44.000+0000
Affected Version/sRelease 2.1.3, Release 3.0.0
Fix Version/s2013 Sprint 07 Core, 2013 Sprint 07
ComponentsiOS
Labelstriage
ReporterMoritz Roessler
AssigneeMax Stepanov
Created2012-10-31T07:44:33.000+0000
Updated2017-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()

Comments

  1. Daniel Sefton 2012-11-09

    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?
  2. Moritz Roessler 2012-11-09

    I tried this only on Ios devices
  3. Ivan Skugor 2012-11-12

    Cyclic structures are not JSON serializable and "fireEvent" does serialization of argument (on iOS at least :) ). Not sure this bug is valid.
  4. Max Stepanov 2013-03-26

    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();
       
  5. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source