OK, this didn't work. It seemed to work, but only because the app sat for a few 
seconds before the next attempt to print. The print dialog reappears for each 
window from which there was an attempt to print and cancelled. I found no 
thread or hint on how to fix this. It seems to be related to garbage 
collection, but it's not clear, if so, what to do in finalize. Even when the 
previous window is closed, when trying to print, that previous window is opened 
and the print dialog presented within. After a while though such self-reopened 
windows fall apart, like list entries going missing and labels presenting no 
more strings.

I tried:
forcing garbage collection in finalize
suggesting garbage collection in finalize
removing printed view from notification center, even though it has never been 
made an observer
setting all properties of printed view to nil in finalize
cleanUpOperation in printOperationDidRun

The view's finalize method is processed, so it definitely seems to get 
collected. Any help is greatly appreciated.


{
.....
    NSDictionary *printJob = [NSDictionary 
dictionaryWithObjectsAndKeys:allItems,kPrintItems,nil];

//this is just for testing to print the same job multiple times for serial 
letter function
    NSArray *printData = [NSArray 
arrayWithObjects:printJob,printJob,printJob,nil];

    NSPrintInfo *pi = [NSPrintInfo sharedPrintInfo];
    LXPrintView *pv = [[LXPrintView alloc] initWithPrintObjects:printData 
andPrintInfo:pi forPrintDelegate:self];
    
    NSPrintOperation *op = [NSPrintOperation printOperationWithView:pv 
printInfo:pi];
    [pv release];
    
    [op runOperationModalForWindow:[[self view] window]
                          delegate:self
                                
didRunSelector:@selector(printOperationDidRun:success:contextInfo:)
                                   contextInfo:nil];
    
    
    [pv release];
}

- (void)printOperationDidRun:(NSPrintOperation *)printOperation  
success:(BOOL)success  contextInfo:(void *)contextInfo
{

    [printOperation cleanUpOperation];
}



Am 13.10.2011 um 11:51 schrieb Alexander Reichstadt:

> [op cleanUp];
that should have been cleanUpOperation
> 
> Thanks
> 
> Am 13.10.2011 um 11:48 schrieb Alexander Reichstadt:
> 
>> Hi,
>> 
>> in our project we have a print operation to print from a view drawn offline. 
>> This all works fine. But if the operation is cancelled in the printdialog 
>> and document window closed, another document window selected and then 
>> ordered to print, the print dialog shows up twice. Once for the previously 
>> cancelled operation and once for the current operation. This can be 
>> increased arbitrarily. All cancelled operations are represented to the user.
>> 
>> Garbage collection is turned on, if this is relevant.
>> 
>> Is there something else that needs to be done in case it is cancelled?
>> 
>> Thanks
>> Alex
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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/lxr%40mac.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to