On 22/08/2013, at 5:59 PM, Graham Cox <graham....@bigpond.com> wrote:

> I suggest logging 'self' at the point you set up your undo. If you can 
> trigger the bug, then this will tell you what the real object responsible for 
> the exception is - at the moment NSProxy is hiding it from you.

Thanks, I'm trying that, although the app also hijacks stderr. The problem is 
that it only seems to happen very rarely -- not since I started trying to hunt 
it down. Maybe if I say I've fixed it, it'll turn up on, um, queue ;-)

>> The process takes a fair amount of time -- it could even be a minute or more 
>> -- so I'm doing it on a background operation queue. Only if that first part 
>> goes fine do I update the UI with the result in an undoable fashion, using 
>> the above. I'm not sure there's a better way.
> 
> Maybe post the code that's in the block - someone might spot something iffy.

Nothing exotic:

    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
        NSUndoManager *undoMan = [[self window] undoManager];
        [undoMan beginUndoGrouping];
        [[undoMan prepareWithInvocationTarget:self] unCompileWith:[[doc 
scriptViewContents] copy] at:sel1 and:sel2];
        if (![undoMan isUndoing]) {
            [undoMan setActionName:@"Compile"];
        }
        [undoMan setActionIsDiscardable:YES];
        // make the changes
        [undoMan endUndoGrouping];
    }];



-- 
Shane Stanley <sstan...@myriad-com.com.au>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


_______________________________________________

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

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

Reply via email to