Re: Quick Looking big files crash

2011-05-24 Thread Brad Stone
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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40softraph.com
> 
> This email sent to cocoa-...@softraph.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Brad Stone
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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Nick Zitzmann

On May 3, 2011, at 5:27 PM, Brad Stone wrote:

> My app stores an NSURL to a file.  All I'm doing is acting as the data source 
> and delegate for QL and giving it access to an NSArray with the URL.  I'm not 
> creating a plugin (or am I misunderstanding you). 

No, when you said "QuickLook" I thought "QuickLook plugin", sorry. Does setting 
a symbolic breakpoint on auto_zone_resurrection_error get any bites?

Nick Zitzmann


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Wim Lewis

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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Brad Stone
My app stores an NSURL to a file.  All I'm doing is acting as the data source 
and delegate for QL and giving it access to an NSArray with the URL.  I'm not 
creating a plugin (or am I misunderstanding you). 

On May 3, 2011, at 6:59 PM, Nick Zitzmann wrote:

> 
> On May 3, 2011, at 4:45 PM, Brad Stone wrote:
> 
>> Here's what I get when I QL a large file.
>> 
>> proNotes(52698,0x1196fd000) malloc: reference count underflow for 
>> 0x201afc920, break on auto_refcount_underflow_error to debug. (17 times)
>> proNotes(52698,0x1196fd000) malloc: resurrection error for object 
>> 0x201f0a380 while assigning {conservative-block}[352](0x20189fc40)[304] = 
>> CFRunLoopSource[128](0x201f0a380)
>> garbage pointer stored into reachable memory, break on 
>> auto_zone_resurrection_error to debug (13 times)
>> 
>> 
>> Then crash.  What should I look for?  How should I approach debugging this?
> 
> 
> Do this:
> 
> 1. In your project, add an executable for /usr/bin/qlmanage
> 2. Give it an argument that points to a file that your importer handles, plus 
> any flags you need to pass to the task
> 3. If you haven't done so already, make a symbolic link pointing to your 
> built importer product, and place it where you normally place your QuickLook 
> generators (so it loads the built product instead of a copy of the built 
> product)
> 4. Make a symbolic breakpoint for auto_zone_resurrection_error
> 5. Build and debug
> 
> If you set up everything correctly, then Xcode's debugger will launch 
> qlmanage, which will load your plugin, and trigger the problem, and cause the 
> debugger to break. Good luck; debugging plugins isn't always easy.
> 
> Nick Zitzmann
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Brad Stone
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.

On May 3, 2011, at 6:52 PM, Wim Lewis wrote:

> 
> On 3 May 2011, at 3:45 PM, Brad Stone wrote:
>> Here's what I get when I QL a large file.
>> 
>> proNotes(52698,0x1196fd000) malloc: reference count underflow for 
>> 0x201afc920, break on auto_refcount_underflow_error to debug. (17 times)
>> proNotes(52698,0x1196fd000) malloc: resurrection error for object 
>> 0x201f0a380 while assigning {conservative-block}[352](0x20189fc40)[304] = 
>> CFRunLoopSource[128](0x201f0a380)
>> garbage pointer stored into reachable memory, break on 
>> auto_zone_resurrection_error to debug (13 times)
>> 
>> 
>> Then crash.  What should I look for?  How should I approach debugging this?
> 
> Have you tried breaking on auto_refcount_underflow_error and 
> auto_zone_resurrection_error?
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40softraph.com
> 
> This email sent to cocoa-...@softraph.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Nick Zitzmann

On May 3, 2011, at 4:45 PM, Brad Stone wrote:

> Here's what I get when I QL a large file.
> 
> proNotes(52698,0x1196fd000) malloc: reference count underflow for 
> 0x201afc920, break on auto_refcount_underflow_error to debug. (17 times)
> proNotes(52698,0x1196fd000) malloc: resurrection error for object 0x201f0a380 
> while assigning {conservative-block}[352](0x20189fc40)[304] = 
> CFRunLoopSource[128](0x201f0a380)
> garbage pointer stored into reachable memory, break on 
> auto_zone_resurrection_error to debug (13 times)
> 
> 
> Then crash.  What should I look for?  How should I approach debugging this?


Do this:

1. In your project, add an executable for /usr/bin/qlmanage
2. Give it an argument that points to a file that your importer handles, plus 
any flags you need to pass to the task
3. If you haven't done so already, make a symbolic link pointing to your built 
importer product, and place it where you normally place your QuickLook 
generators (so it loads the built product instead of a copy of the built 
product)
4. Make a symbolic breakpoint for auto_zone_resurrection_error
5. Build and debug

If you set up everything correctly, then Xcode's debugger will launch qlmanage, 
which will load your plugin, and trigger the problem, and cause the debugger to 
break. Good luck; debugging plugins isn't always easy.

Nick Zitzmann


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Quick Looking big files crash

2011-05-03 Thread Wim Lewis

On 3 May 2011, at 3:45 PM, Brad Stone wrote:
> Here's what I get when I QL a large file.
> 
> proNotes(52698,0x1196fd000) malloc: reference count underflow for 
> 0x201afc920, break on auto_refcount_underflow_error to debug. (17 times)
> proNotes(52698,0x1196fd000) malloc: resurrection error for object 0x201f0a380 
> while assigning {conservative-block}[352](0x20189fc40)[304] = 
> CFRunLoopSource[128](0x201f0a380)
> garbage pointer stored into reachable memory, break on 
> auto_zone_resurrection_error to debug (13 times)
> 
> 
> Then crash.  What should I look for?  How should I approach debugging this?

Have you tried breaking on auto_refcount_underflow_error and 
auto_zone_resurrection_error?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Quick Looking big files crash

2011-05-03 Thread Brad Stone
I added Quartz and QuickLook frameworks to my garbage-collection-required app 
and then added simple Quick Look functionally.  

The bigger the file the more errors I get.  Small pdfs show no errors, large 
ppts, xl or zip files show a bunch of errors and eventually crash.  I'm not 
familiar with non-garbage collection memory management.  I wouldn't even be 
able to determine if these errors are telling me I should be.  Please help.

Here's what I get when I QL a large file.

proNotes(52698,0x1196fd000) malloc: reference count underflow for 0x201afc920, 
break on auto_refcount_underflow_error to debug. (17 times)
proNotes(52698,0x1196fd000) malloc: resurrection error for object 0x201f0a380 
while assigning {conservative-block}[352](0x20189fc40)[304] = 
CFRunLoopSource[128](0x201f0a380)
garbage pointer stored into reachable memory, break on 
auto_zone_resurrection_error to debug (13 times)
 

Then crash.  What should I look for?  How should I approach debugging this?

Thanks___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com