Re: NSUndoManager auto-grouping?
Re: NSUndoManager auto-grouping?
- Subject: Re: NSUndoManager auto-grouping?
- From: Kyle Sluder <email@hidden>
- Date: Tue, 15 Dec 2009 14:17:30 -0800
On Sat, Dec 12, 2009 at 12:16 PM, Scott Squires <email@hidden> wrote:
> Same basic setup for a number of routines, however certain types of routines
> seem to be automatically be grouped.
Have you read the documentation for per-event grouping?
> I have some image processing routines that are on another thread and undo
> objects are created.
Have you read the documentation about how multithreading and
NSUndoManager really don't mix? <grin>
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-122647-BBCCEGFF
Are you, in fact, running image processing routines in the background
and expecting them to add undo groups when they're completed? Surely
you can't expect this to make sense; the order in which they wind up
on the undo stack (even if it were thread safe) is indeterministic,
making undo almost useless.
Or are the operations simply internally parallelized? In that case,
the threads should coordinate amongst themselves, perhaps locking
around a shared undo manager. Alternatively, you could have a serial
GCD queue, and as your work units finish they could enqueue blocks
that themselves register undo events.
(And we should file bug reports to see a block-based API for NSUndoManager…)
--Kyle Sluder
_______________________________________________
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