Re: NSUndoManager grouping somewhat broken?
Re: NSUndoManager grouping somewhat broken?
- Subject: Re: NSUndoManager grouping somewhat broken?
- From: Graham Cox <email@hidden>
- Date: Wed, 9 Apr 2008 10:05:26 +1000
Hi, thanks for that.
The current version of Sketch doesn't have this code, which is why I
couldn't find it ;-)
It does confirm the problem I'm having though so that's useful to know
- it means I'm not doing something stupid with the undo manager.
Interesting that they removed this from Sketch though - I wonder if
that means they think the bug is fixed, or decided it wasn't worth
worrying about? I can demonstrate the bug in a trivial view subclass
that opens the group on mouseDown and ends it on mouseUp, so it's
still there on 10.5.2.
I did find the problem causing the hang at doc close time - it was a
completely unrelated bug that was somehow mangling memory. I'm don't
truly understand how it was really causing the problem but once
discovered it cleared that aspect up entirely. (I'm assuming that the
memory damage was touching an object in the undo stack causing the
check of its state to enter an infinite loop).
Anyway, thanks for your help, appreciate it.
G.
On 9 Apr 2008, at 2:34 am, Quincey Morris wrote:
On Apr 8, 2008, at 05:04, Graham Cox wrote:
Thanks, but unfortunately you're mistaken as far as I and my
exhaustive "project find" command can see - Sketch does not use
undo grouping at all (seems there is no real need for Sketch to
deal with the possibility of multiple undoable operations being
grouped because it's so simple and only really does one kind of
editing thing at a time).
So I'm still looking for confirmation that the empty group problem
is a real bug and some sort of workaround for it.
I'm not sure if you meant you couldn't find the code I was talking
about (maybe you have a different version of Sketch), or that you
found it and it was of no use to you. If the latter, then nvm, it
was just a thought. If the former, well, here's the code.
Admittedly, it's not grouping operations from widely separated
places in the code, but it is conditionally suppressing nested undo
groups when it doesn't know in advance whether there is going to be
anything in them, without "leaking" an empty top level group. That
sounded a lot like what you were struggling with.
- (void)createGraphicOfClass:(Class)graphicClass withEvent:(NSEvent
*)event {
_______________________________________________
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