AlanQuatermain / AQGridView

A grid view for iPhone/iPad, designed to look similar to NSCollectionView.
http://quatermain.tumblr.com/
BSD 3-Clause "New" or "Revised" License
2.37k stars 450 forks source link

updateNewGridDataAndCreateMappingTables for 64 bit #208

Closed karmeye closed 1 year ago

karmeye commented 10 years ago

Anyone fixed this method (AQGridViewUpdateInfo updateNewGridDataAndCreateMappingTables) for 64 bit builds?

I get assertion on: NSAssert(_oldToNewIndexMap[_oldGridData.numberOfItems] == 0x55555555, @"Eeek! Scribbling on guards didn't work!");

n8tr commented 10 years ago

I noticed that building in release mode prevents the crash. You can also set change #define GUARD_ITEMS 1 to #define GUARD_ITEMS 0. Does not address the underlying problem though as I'm not exactly sure the the GUARD_ITEMS are about. Perhaps verification that the bit counts are within the max number of bits that can be allocated?

AlanQuatermain commented 10 years ago

They’re actually quite ancient, and can probably be turned off altogether now. There were some buffer overrun problems in that code at one point, where things were generating invalid array indices. All fixed now though, so you can just turn off that code.

n8tr commented 10 years ago

Great thanks :+1:

ioodo commented 10 years ago

but if turn off the #define GUARD_ITEMS 0 and when drag to remove the second last icon, will crash

ioodo commented 10 years ago

[NSMutableIndexSet addIndexesInRange:]: Range {2438690640, 1} exceeds maximum index value of NSNotFound - 1'

ioodo commented 10 years ago

it is happend random, in AQGridView:setAnimatingCells when i remove the sencond lastest icon

afterthought commented 9 years ago

I haven't completely vetted this yet, but this seems to work well so far in my testing:

#if __LP64__
#define SCRIBBLE_MARK 0x5555555555555555
#else
#define SCRIBBLE_MARK 0x55555555
#endif

Maybe not elegant, but I'm just trying to get some old code working reliably.

NSAssert(_newToOldIndexMap[_newGridData.numberOfItems] == SCRIBBLE_MARK, @"Eeek! Scribbling on guards didn't work!");