简体   繁体   中英

Xcode debugging: Exception cached?

I have an issue with cached error handling in X-Code. I commented a particular line out, but i still get the same error for this line.

I cleaned the project, i deleted the build folder, i replaced (deleted and imported again) all references. But still i get an error in the line where is nothing. Even if i comment out everything, i get the same error.

- (void) setTileSource: (id<RMTileSource>)newTileSource
{
    if (tileSource == newTileSource)
        return;

    RMCachedTileSource *newCachedTileSource = [RMCachedTileSource cachedTileSourceWithSource:newTileSource];

    newCachedTileSource = [newCachedTileSource retain];
    [tileSource release];
    tileSource = newCachedTileSource;

---> here is the SIGABRT exception

     // NSAssert(([tileSource minZoom] - minZoom) <= 1.0, @"Graphics & memory are 
    [projection release];
    projection = [[tileSource projection] retain];

    [mercatorToTileProjection release];
    mercatorToTileProjection = [[tileSource mercatorToTileProjection] retain];

    [imagesOnScreen setTileSource:tileSource];

        [tileLoader reset];
    [tileLoader reload];
}

Shouldn't you retain the titleSource ? Try,

tileSource = [newCachedTileSource copy];

I suspect that means that the exception is not caused by the line you commented out.

Firstly, why do you do this:

newCachedTileSource = [newCachedTileSource retain];

retain returns self. You don't need to assign the result to the same object pointer. If the library overrides retain to return something different, the library is broken.

Secondly, I think this might be a bug:

[projection release];
projection = [[tileSource projection] retain];

If projection == [tileSource projection] before the release, it may be possible it is somehow getting over released. Does the problem go away if you do:

RMProjection* newProjection = [[tileSource projection] retain];
[projection release];
projection = newProjection;

Ideally, you would create a synthesized retain property for projection (actually projection could just get the value from the tileSource) like so:

-(RMProjection*) projection
{
    return [[self tileSoruce] projection];
}

Same for mercatorToTileProjection.

Change [tileSource release]; to [tileSource autorelease];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM