Re: Quick Looking big files crash
Re: Quick Looking big files crash
- Subject: Re: Quick Looking big files crash
- From: Brad Stone <email@hidden>
- Date: Tue, 24 May 2011 16:30:48 -0400
So it looks like the QuickLook framework has some bugs with Garbage Collection required.
I contacted Apple tech support and they confirmed this is "likely a bug in the Quick Look framework" and asked me to file a bug report. Too bad this cost me one of my free tech support chits.
In the mean time I'm incorporating QL this way:
NSString *paths = @"";
for (NSString *thisPath in srcPathArray) {
NSString *s = @"";
if ([paths length] == 0) {
s = [NSString stringWithFormat:@"(quoted form of (POSIX path of \"%@\"))", thisPath];
} else {
s = [NSString stringWithFormat:@" & \" \" & (quoted form of (POSIX path of \"%@\"))", thisPath];
}
paths = [paths stringByAppendingString:s];
}
NSAppleScript *quickLook = nil;
// do shell script ("qlmanage -p " & (quoted form of (POSIX path of srcPath)))
NSString *command = [NSString stringWithFormat:@"do shell script (\"qlmanage -p \" & %@)",paths];
quickLook = [[NSAppleScript alloc] initWithSource:command];
[quickLook executeAndReturnError:nil];
On May 3, 2011, at 9:09 PM, Brad Stone wrote:
> Interesting, OK, now remember, t this is new to me.
>
> To begin the QL panel I run this required method:
> - (void)beginPreviewPanelControl:(QLPreviewPanel *)panel
> {
> previewPanel = [panel retain];
> panel.delegate = self;
> panel.dataSource = self;
> }
>
> and then it ends with
>
> - (void)endPreviewPanelControl:(QLPreviewPanel *)panel
> {
> [previewPanel release];
> previewPanel = nil;
> }
>
> Where QLPreviewPanel* previewPanel; is defined in my header file.
>
> The crash happens after the begin and never gets to the end.
>
> I see here http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html that to "ensure the longevity of Objective-C objects, you should use CFRetain instead of retain".
>
> I haven't been able to find the correct syntax to replace the retain/release with CFRetain/CFRelease
>
> On May 3, 2011, at 7:51 PM, Wim Lewis wrote:
>
>>
>> On 3 May 2011, at 4:03 PM, Brad Stone wrote:
>>> I have a symbolic breakpoint set and it stops on auto_refcount_underflow_error, even the small files. If I continue the doc shows in QL.
>>
>> Presumably, a few stack frames up, there will be a call to CFRelease() which is causing the underflow (what would be an over-released zombie in a non-GC app).
>>
>> The first thing I'd look for is using CFRelease() when you should call -release (or vise versa, and the same for retain): code written pre-GC would treat those as equivalent, but in a GC or optional-GC world they need to be treated as operating on distinct kinds of refcount.
>>
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden