잘못된 플러시 채우기 방법이 잘못된 액세스 오류로 인해 충돌하며 어떤 오류 메시지를 찾을 수 없습니까?Flood Fill 메서드가 잘못된 액세스 오류로 인해 충돌하면 오류가 발생합니까?
내가 내 응용 프로그램을 시작할 때 나는 작은 물체를 잘 칠할 수 있지만 페인트 물통처럼 채우기 물감을 채워서 더 큰 물체를 채울 페인트를 가져 오면 잘못된 액세스 오류로 인해 충돌이 발생합니다.
Im 멍청한 놈과 나는 많은 일을 시도했고 재귀 횟수는 늘어 났지만 여전히 충돌했다. 이 앱과 함께 ARC를 사용하고 있습니다.
-(void)paintingBucket:(int)point point2:(int)point2 width:(int)width colorAtPoint:(UIColor *)color {
int offset = 0;
int x = point;
int y = point2;
if (point<1025 && point2<705) {
offset = 4*((width*round(y))+round(x));
int alpha = data[offset];
int red = data[offset + 1];
int green = data[offset + 2];
int blue = data[offset + 3];
color1 = [UIColor colorWithRed:(green/255.0f) green:(red/255.0f) blue:(alpha/255.0f) alpha:(blue/255.0f)];
if ([color1 isEqual: color]) {
color3 = self.currentColor ;
CGFloat r,g,b,a;
[color3 getRed:&r green:&g blue: &b alpha: &a];
int reda = (int)(255.0 * r);
int greena = (int)(255.0 * g);
int bluea = (int)(255.0 * b);
int alphaa = (int)(255.0 * a);
// NSLog(@" red: %u green: %u blue: %u alpha: %u", reda, greena, bluea, alphaa);
data[offset + 3] = alphaa;
data[offset + 2] = reda;
data[offset + 1] = greena;
data[offset] = bluea;
[self paintingBucket:x+1 point2:y width:width colorAtPoint:color];
[self paintingBucket:x point2:y+1 width:width colorAtPoint:color];
[self paintingBucket:x-1 point2:y width:width colorAtPoint:color];
[self paintingBucket:x point2:y-1 width:width colorAtPoint:color];
}
}
}
편집 : 나는 그것을이되어 충돌 할 때 얻을 정보 만 "0x995d7d5f를 : calll 0x995d7d64, szone_malloc_should_clear + 14"
난 일부 메모리 문제가 있음을 이해하지만 난 해결을 식별하지 못할 그것. 나는 메신저를 객관적인 C로 돌리므로 어떤 도움도 좋을 것입니다.
어쩌면 콘솔에서 충돌 정보를 찾아서 디버거 스택 디스플레이에 문제가 발생했다는 것을 알 수 있습니다. 그런 다음 해당 정보를 게시물에 포함하십시오. –
데이터 [] 배열에 쓰려고합니다. 어쩌면 너무 작을 수 있습니다. –
데이터 배열이 비트 맵 픽셀을 나타내므로 도달하는 반복 횟수보다 많은 픽셀이 있기 때문에 그렇게 생각하지는 않습니다. – lost4ever