Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

dequeueReusableCellWithIdentifier: deletes the cell it is supposed to return #138

Open
dtartaglia opened this Issue · 11 comments

6 participants

@dtartaglia

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]; }
@venkatd

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 );
}
@claybridges

We are seeing problems which strongly appear that they are related to this.

@dtartaglia

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?

@claybridges

Same, we are not ARC.

@venkatd

Not using ARC either.

@classbox

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.

@evadne
Collaborator
@claybridges

@evadne Are you saying that AQGridView, which is itself fully ARC, cannot be used in a mixed ARC/non-ARC project?

@evadne
Collaborator
@AlanQuatermain
@claybridges

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.