UIImagePickerController crashes when fast scrolling, slower than photo app

In most cases, my puller works fine (iOS 4.2.1). However, if I scroll very quickly up and down about 4-6 times through my cameras from about 300 photos, I get a crash. This never happens with the β€œphotos” app on the same iPhone 3Gs. In addition, I notice that the stock application scrolls a lot more smoothly than my image picker.

Has anyone else noticed this behavior? I would be interested if others can try to do this in their applications and see if they crash. I do not think that this is due to other objects that support memory on my iPhone, because it is a simple application, and this happens immediately after the application starts. It also does not seem to be related to messages sent to other released objects or re-release of other objects in viewdidunload, depending on my crash logs and the fact that the simulator responds well to simulated memory warnings. I think this may be a mistake in the internal implementation of UIImagePickerController ...

This is how I start the collector. I did this in several ways (including setting the save property for the UIImagePickerController in my header and freeing up on dealloc). This is apparently the best way (falls less):

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.allowsEditing = YES;         
[self presentModalViewController:picker animated:YES];
[picker release];

This is a broken thread (I get various types of exceptions):

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0xfffffffff4faafa4
Crashed Thread:  8
...
Thread 8 Crashed:
0   CoreFoundation      0x000494ea -[__NSArrayM replaceObjectAtIndex:withObject:] + 98
1   PhotoLibrary        0x00008e0f -[PLImageTable _segmentAtIndex:] + 527
2   PhotoLibrary        0x00008a21 -[PLImageTable _mappedImageDataAtIndex:] + 221
3   PhotoLibrary        0x0000893f -[PLImageTable dataForEntryAtIndex:] + 15
4   PhotoLibrary        0x000087e7 PLThumbnailManagerImageDataAtIndex + 35
5   PhotoLibrary        0x00008413 -[PLThumbnailManager _dataForPhoto:format:width:height:bytesPerRow:dataWidth:dataHeight:imageDataOffset:imageDataFormat:preheat:] + 299
6   PhotoLibrary        0x000b6c13 __-[PLThumbnailManager preheatImageDataForImages:withFormat:]_block_invoke_1 + 159
7   libSystem.B.dylib   0x000d6680 _dispatch_call_block_and_release + 20
8   libSystem.B.dylib   0x000d6ba0 _dispatch_worker_thread2 + 128
9   libSystem.B.dylib   0x0007b251 _pthread_wqthread + 265
+5
source share
1 answer

I defined a fix that greatly improves the scroll performance of the image picker and completely eliminates crashes. Unfortunately, I do not know why this works.

In the above code, change:

picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

at

picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
+10
source

All Articles