discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUNdoManager issues...


From: Lloyd Dupont
Subject: Re: NSUNdoManager issues...
Date: Tue, 21 Feb 2006 11:37:00 +1000

Here is a bug sample show casing my undo problem...

=== BugSample.m ======
#import <Foundation/Foundation.h>

@interface MyObject : NSObject
{
}
- (void) setMyValue: (NSString*) name;
@end
@implementation MyObject
- (void) setMyValue: (NSString*) name
{
}
@end

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];


NSUndoManager * undo = [[[NSUndoManager alloc] init] autorelease];
printf("New undo level: %d\n", [undo groupingLevel]);
printf("New CanUndo: %s\n", [undo canUndo] ? "YES" : "NO");

// some stupid calls...
MyObject *test = [[[MyObject alloc] init] autorelease];
[[undo prepareWithInvocationTarget:test] setMyValue:@"hjk"];
printf("Stupid calls undo level: %d\n", [undo groupingLevel]);
printf("Stupid calls CanUndo: %s\n", [undo canUndo] ? "YES" : "NO");


[undo removeAllActions];
printf("Removed undo level: %d\n", [undo groupingLevel]);
printf("Removed CanUndo: %s\n", [undo canUndo] ? "YES" : "NO");


   // insert code here...
   [pool release];
   return 0;
}

======= MacOSX output ====
New undo level: 0
New CanUndo: NO
Stupid calls undo level: 1
Stupid calls CanUndo: YES
Removed undo level: 0
Removed CanUndo: NO

===== GNUstep (3 month old) output =====
New undo level: 0
New CanUndo: NO
Stupid calls undo level: 1
Stupid calls CanUndo: YES
Removed undo level: 1
Removed CanUndo: YES

===============

Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
----- Original Message ----- From: "Richard Frith-Macdonald" <richard@brainstorm.co.uk>
To: "Lloyd Dupont" <lloyd@nova-mind.com>
Sent: Monday, February 20, 2006 6:04 PM
Subject: Re: NSUNdoManager issues...



On 20 Feb 2006, at 03:17, Lloyd Dupont wrote:

I have the following problem:
in my code I write something like that:

NSUndoManager *undo = [[NSUndoManager alloc] init];
... stuff happening ....
[undo removeAllActions];

Then I ask [undo canUndo]
it return yes!
I have to do write instead
while([undo groupingLevel])
   [undo endUndoGrouping];
[undo removeAllActions];

to really empty it.
I think it's a bug.

Sounds like it ... but perhaps the method is only meant to operate on the current group, Please could you send me a small testcase showing the problem .... and I will try it on MacOS-X to check behavior, and iendeavour to make the base library match MacOS-X





reply via email to

[Prev in Thread] Current Thread [Next in Thread]