Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13333] iOS: setting view property cause "Collection <CALayerArray: 0x645dfc0> was mutated while being enumerated.”

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelslayer, proxy, thread, view
ReporterMartin Guillon
AssigneeUnknown
Created2012-10-24T09:08:32.000+0000
Updated2018-02-28T20:04:22.000+0000

Description

My app is doing pretty fast animations. Especially depending on user interaction, views can be very quickly animated, modified (visibility, opacity). Recently i have been facing a lot of crash:
Collection <CALayerArray: 0x645dfc0> was mutated while being enumerated.
I have been trying to to the depth of that bug. This what i have found. I post as an image the callstack in xcode. What i can say is that the bug is appearing when processing a
view.visible = true
in my script. What i think is happening is that we try to change the hidden property of a layer while modifying the layers stack (insertSubview in TiViewProxy). I have also been looking on the web for this one and i have found a post related to that http://stackoverflow.com/questions/1711700/iphone-ui-addsubview-causing-concurrency-exception I have been trying to create a simple example of this without success. And i cant post the code of my app. Will still try to find a test case. Yet i think we already have enough information to understand that bug, and so start working onit.

Attachments

FileDateSize
Screen Shot 2012-10-24 at 11.03.39 AM.png2012-10-24T09:08:32.000+000090790

Comments

  1. Martin Guillon 2012-10-24

    So i keep on working on this one. This is what i have now. What is happening is that [TiUIView::setVisible_](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIView.m#L561) is called while that view in is parent in [TiViewProxy::insertSubview](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiViewProxy.m#L2121) I have tried using @synchronized without success. I need help on this.
  2. Ingo Muschenetz 2012-11-28

    Martin, can you please confirm this also happens on 3.0.0?
  3. Martin Guillon 2012-11-30

    i can confirm it WASN'T happening in 3.0.0, at least at githash 484f237
  4. Ingo Muschenetz 2013-03-15

    Try setting opacity to 0 instead and see if that solves the issue for now.
  5. Martin Guillon 2013-03-18

    Actually i think i fixed this in my branch. Will have to look through the code to find the solution :s EDIT: also i cant use opacity = 0. i actually use a combination of opacity and visibility. They dont have the same meaning

JSON Source