AQGridView
AQGridView copied to clipboard
dequeueReusableCellWithIdentifier: deletes the cell it is supposed to return
the method should retain the cell before removing it from cells and the autorelease it just before returning it. Proposed solution:
- (AQGridViewCell *) dequeueReusableCellWithIdentifier: (NSString *) reuseIdentifier { NSMutableSet * cells = [_reusableGridCells objectForKey: reuseIdentifier]; AQGridViewCell * cell = [cells anyObject]; [cell prepareForReuse]; [cell retain]; if (cell) { [cells removeObject: cell]; } return [cell autorelease]; }
I was running into issues with this also
- (AQGridViewCell *) dequeueReusableCellWithIdentifier: (NSString *) reuseIdentifier
{
NSMutableSet * cells = [_reusableGridCells objectForKey: reuseIdentifier];
AQGridViewCell * cell = [cells anyObject];
if ( cell == nil )
return ( nil );
[cell prepareForReuse];
/* Added the line below so that a cell doesn't get released IMMEDIATELY after it is removed */
[[cell retain] autorelease];
[cells removeObject: cell];
return ( cell );
}
We are seeing problems which strongly appear that they are related to this.
Maybe this isn't a problem with ARC? I'm not using ARC and I don't think venkatd is either. What about you claybridges?
Same, we are not ARC.
Not using ARC either.
I am not using ARC and ran into this issue, which led to random crashes that were hard to debug. Everything worked when I got rid of the dequeueReusableCellWithIdentifier call.
Not using ARC is no longer supported. Sorry about that.
On Sep 20, 2012, at 3:22, Tian [email protected] wrote:
I am not using ARC and ran into this issue, which led to random crashes that were hard to debug. Everything worked when I got rid of the dequeueReusableCellWithIdentifier call.
— Reply to this email directly or view it on GitHubhttps://github.com/AlanQuatermain/AQGridView/issues/138#issuecomment-8722647.
@evadne Are you saying that AQGridView, which is itself fully ARC, cannot be used in a mixed ARC/non-ARC project?
It should work without issues. Cases where it does not work will be considered high priority bugs.
On Sep 20, 2012, at 11:17, Clay Bridges [email protected] wrote:
@evadne https://github.com/evadne Are you saying that AQGridView, which is itself fully ARC, cannot be used in a mixed ARC/non-ARC project?
— Reply to this email directly or view it on GitHubhttps://github.com/AlanQuatermain/AQGridView/issues/138#issuecomment-8740362.
There shouldn't be any problem linking directly to a prebuilt binary which was built using ARC, but if you're including the source directly you need to set the -fobjc-arc parameter on each AQGridView source file.
Note that the suggested code from Daniel Tartaglia at the start of this thread is only necessary when compiling AQGridView itself without ARC support — which, as @evadne rightly stated, is no longer supported.
My problems were from using the 1.3 CocoaPod version (which is all ARC; -fobjc-arc
added automatically from s.requires_arc = true
) in our primarily non-ARC app.
Thank you!! . This article very help full for me