Crash dragging an item from one flow layout to another (shinobiessentials 2.7.0)


#1

Based on the Multiflow example code

https://github.com/ShinobiControls/essentials-multiflow 

My code works fine in an older version of ShinobiEssentials (2.5.1 I think) but once I upgraded to the latest 2.7.0 version I get crashes. Its seems others experience this too http://www.shinobicontrols.com/forum/shinobicontrols/2013/9/flow-layout-drag-view-from-one-container-to-another- but I felt this warranted a new ticket as this is may be a bug rather than a ‘how to’ request.

Basically, dragging a managed view from one flow to another, as it crosses into the bounds of another flow, the app crashes. This is not consistantly happening but for me normally within 10 moves. 

Looking at the number I guess a numeric rollover is occuring but without the source code its hard to know why.

2014-07-11 09:46:34.419 ----------[28940:4545177] *** Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 2147483646 beyond bounds [0 … 2]’

*** First throw call stack:

(

0   CoreFoundation                      0x03795646 __exceptionPreprocess + 182

1   libobjc.A.dylib                     0x034378e3 objc_exception_throw + 44

2   CoreFoundation                      0x0366a443 -[__NSArrayM objectAtIndex:] + 243

3   ----------                          0x00308817 -[FlowPicker isLeftMost:inOrdering:] + 72

4   ----------                          0x0030824e -[FlowPicker widenedSubviewExcludingView:inOrdering:] + 908

5   ----------                          0x00307da4 -[FlowPicker indexOfPoint:currentBounds:currentIndex:inOrdering:excludingView:] + 135

6   ----------                          0x003053fd -[FlowEdit changeEdit:] + 611

7   ----------                          0x003048f5 -[FlowEdit fireChangeEdit:afterTimeout:] + 413

8   ----------                          0x00304750 -[FlowEdit handleLongPress:] + 407


#2

Update, I can get the app to stop crashing by delaying the unmanaging of the subview from the flow it is being removed from…

                [destinationFlow addManagedSubview:view];
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
                    [sourceFlow unmanageSubview:view];
                 });