etoile / CoreObject

Distributed version control + object persistence framework

Home Page:http://coreobject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selective undo in ProjectDemo shows up in the undo UI without a label

ericwa opened this issue · comments

screen shot 2016-09-28 at 12 07 56 am

Also, the "Step Backward" button in the "Document History" window generates an undo item with no label (but the toolbar button for "Step Backward" generates an undo entry with a label)

It's probably a localization issue, I'll take a look at it and let you know.

I tried to reproduce your issue today, but Typewriter history looks fine on my machine with the current repository:

capture d ecran 2016-09-29 a 17 48 30

I'll try to add a French localization to Typewriter and see whether the history appears correctly or not.

I added a French localization of the history and fixed several project group reference issues, you might want to give a new try now.

capture d ecran 2016-09-29 a 19 05 22

btw I only tested and noticed the issue in ProjectDemo, didn't check Typewriter.

Currently I am getting an exception in ProjectDemo if I try to do a selective undo from the Document History window:

Exception Name: NSInvalidArgumentException
Description: Node COCommandGroup 5353382f-ffb7-4c38-52c0-4c2ffd0415ad
    (null) must belong to the track <COUndoTrack: 0x6080000887a0> to retrieve the previous or next node
User Info: (null)

0   CoreFoundation                      0x00007fff810a47bb __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fff95811a2a objc_exception_throw + 48
2   CoreFoundation                      0x00007fff81121a65 +[NSException raise:format:] + 197
3   CoreObject                          0x000000010040e01f -[COUndoTrack nextNodeOnTrackFrom:backwards:] + 223
4   CoreObject                          0x000000010040dd97 -[COUndoTrack canRedo] + 103
5   ProjectDemo                         0x0000000100043efe -[EWUndoWindowController validateButtons] + 158
6   ProjectDemo                         0x0000000100043c39 -[EWUndoWindowController update] + 121
7   ProjectDemo                         0x0000000100043e49 -[EWUndoWindowController undoTrackDidChange:] + 121
8   CoreFoundation                      0x00007fff810316ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
9   CoreFoundation                      0x00007fff810315ab _CFXRegistrationPost + 427
10  CoreFoundation                      0x00007fff81031312 ___CFXNotificationPost_block_invoke + 50
11  CoreFoundation                      0x00007fff80fefa32 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 2018
12  CoreFoundation                      0x00007fff80feea1b _CFXNotificationPost + 667
13  Foundation                          0x00007fff82a1c0e3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
14  CoreObject                          0x000000010041688d -[COUndoTrack postNotificationsForTrackName:] + 605
15  CoreObject                          0x000000010041697d -[COUndoTrack didUpdate] + 141
16  CoreObject                          0x0000000100415040 -[COUndoTrack reloadNodesOnCurrentBranch] + 3568
17  CoreObject                          0x0000000100415383 -[COUndoTrack reload] + 787
18  CoreObject                          0x00000001004165d8 -[COUndoTrack storeTrackDidChange:] + 1176
19  CoreFoundation                      0x00007fff810316ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
20  CoreFoundation                      0x00007fff810315ab _CFXRegistrationPost + 427
21  CoreFoundation                      0x00007fff81031312 ___CFXNotificationPost_block_invoke + 50
22  CoreFoundation                      0x00007fff80fefa32 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 2018
23  CoreFoundation                      0x00007fff80feea1b _CFXNotificationPost + 667
24  Foundation                          0x00007fff82a1c0e3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
25  CoreObject                          0x00000001004069a3 -[COUndoTrackStore postCommitNotificationsWithUserInfo:] + 835
26  CoreObject                          0x0000000100406f09 -[COUndoTrackStore postCommitNotifications] + 1161
27  CoreObject                          0x00000001003fffc6 -[COUndoTrackStore commitTransaction] + 566
28  CoreObject                          0x0000000100410b88 -[COUndoTrack recordCommand:] + 2872
29  CoreObject                          0x00000001004072d8 -[COEditingContext(Undo) recordEndUndoGroupWithUndoTrack:] + 296
30  CoreObject                          0x0000000100353acc -[COEditingContext commitWithMetadata:restrictedToPersistentRoots:withUndoTrack:error:] + 3900
31  CoreObject                          0x0000000100351eb1 -[COEditingContext commitWithIdentifier:metadata:undoTrack:error:] + 769
32  ProjectDemo                         0x000000010001c343 -[EWHistoryWindowController commitWithIdentifier:descriptionArguments:] + 467
33  ProjectDemo                         0x000000010001b979 -[EWHistoryWindowController selectiveUndo:] + 377
34  libsystem_trace.dylib               0x00007fff9631f03d _os_activity_initiate + 61
35  AppKit                              0x00007fff7f3c44e7 -[NSApplication(NSResponder) sendAction:to:from:] + 456
36  AppKit                              0x00007fff7ef14245 -[NSControl sendAction:to:] + 86
37  AppKit                              0x00007fff7ef1416d __26-[NSCell _sendActionFrom:]_block_invoke + 136
38  libsystem_trace.dylib               0x00007fff9631f03d _os_activity_initiate + 61
39  AppKit                              0x00007fff7ef140c5 -[NSCell _sendActionFrom:] + 128
40  AppKit                              0x00007fff7ef5692a -[NSButtonCell _sendActionFrom:] + 98
41  libsystem_trace.dylib               0x00007fff9631f03d _os_activity_initiate + 61
42  AppKit                              0x00007fff7ef12a58 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2481
43  AppKit                              0x00007fff7ef56667 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 785
44  AppKit                              0x00007fff7ef114c8 -[NSControl mouseDown:] + 832
45  AppKit                              0x00007fff7f52473d -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 6341
46  AppKit                              0x00007fff7f520f8c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
47  AppKit                              0x00007fff7f52042a -[NSWindow(NSEventRouting) sendEvent:] + 541
48  AppKit                              0x00007fff7f3c0bf5 -[NSApplication(NSEvent) sendEvent:] + 1145
49  ProjectDemo                         0x00000001000c7a7e -[Application sendEvent:] + 78
50  AppKit                              0x00007fff7eca7009 -[NSApplication run] + 1002
51  AppKit                              0x00007fff7ec71a8a NSApplicationMain + 1237
52  ProjectDemo                         0x0000000100055422 main + 34
53  ProjectDemo                         0x0000000100001be4 start + 52

I didn't manage to reproduce the exact same undo track crash you had, but I managed to trigger a very similar one. I think this is unrelated to the missing row labels in the Undo History (I'm observing this too). The crash seems to be caused by an issue when reloading the commands/nodes on the current branch. Here is the stack trace I get when I try to double tap a command located in another Undo track branch other than the current one:

#0  0x00007fff85dbef4e in objc_exception_throw ()
#1  0x00007fff89b854bd in +[NSException raise:format:] ()
#2  0x000000010038a42f in -[COUndoTrack nextNodeOnTrackFrom:backwards:]
#3  0x000000010038a1a7 in -[COUndoTrack canRedo]
#4  0x0000000100043d2e in -[EWUndoWindowController validateButtons]
#5  0x0000000100043a69 in -[EWUndoWindowController update]
#6  0x0000000100043c79 in -[EWUndoWindowController undoTrackDidChange:]
#7  0x00007fff89aa9bbc in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#8  0x00007fff89aa9b4f in ___CFXRegistrationPost_block_invoke ()
#9  0x00007fff89aa9ac7 in _CFXRegistrationPost ()
#10 0x00007fff89aa9832 in ___CFXNotificationPost_block_invoke ()
#11 0x00007fff89a665e2 in -[_CFXNotificationRegistrar find:object:observer:enumerator:] ()
#12 0x00007fff89a65835 in _CFXNotificationPost ()
#13 0x00007fff8adca17a in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#14 0x0000000100392c9d in -[COUndoTrack postNotificationsForTrackName:]
#15 0x0000000100392d8d in -[COUndoTrack didUpdate]
#16 0x0000000100391450 in -[COUndoTrack reloadNodesOnCurrentBranch]
#17 0x0000000100391793 in -[COUndoTrack reload]
#18 0x00000001003929e8 in -[COUndoTrack storeTrackDidChange:]
#19 0x00007fff89aa9bbc in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#20 0x00007fff89aa9b4f in ___CFXRegistrationPost_block_invoke ()
#21 0x00007fff89aa9ac7 in _CFXRegistrationPost ()
#22 0x00007fff89aa9832 in ___CFXNotificationPost_block_invoke ()
#23 0x00007fff89a665e2 in -[_CFXNotificationRegistrar find:object:observer:enumerator:] ()
#24 0x00007fff89a65835 in _CFXNotificationPost ()
#25 0x00007fff8adca17a in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#26 0x0000000100382db3 in -[COUndoTrackStore postCommitNotificationsWithUserInfo:]
#27 0x0000000100383319 in -[COUndoTrackStore postCommitNotifications]
#28 0x000000010037c3d6 in -[COUndoTrackStore commitTransaction]
#29 0x000000010038b8cd in -[COUndoTrack setCurrentNodeToDivergentNode:]
#30 0x000000010038a914 in -[COUndoTrack setCurrentNode:]
#31 0x00000001000441a3 in -[EWUndoWindowController doubleClick:]
#32 0x00007fff8a0ab07a in _os_activity_initiate ()
#33 0x00007fff98446dbd in -[NSApplication sendAction:to:from:] ()
#34 0x00007fff98458f12 in -[NSControl sendAction:to:] ()
#35 0x00007fff984d81d5 in -[NSTableView _sendAction:to:row:column:] ()
#36 0x00007fff984d693e in -[NSTableView mouseDown:] ()
#37 0x00007fff989aa3c9 in -[NSWindow _handleMouseDownEvent:isDelayedEvent:] ()
#38 0x00007fff989ab3ad in -[NSWindow _reallySendEvent:isDelayedEvent:] ()
#39 0x00007fff983ea539 in -[NSWindow sendEvent:] ()
#40 0x00007fff9836aa38 in -[NSApplication sendEvent:] ()
#41 0x00000001000c78be in -[Application sendEvent:]
#42 0x00007fff981d1df2 in -[NSApplication run] ()
#43 0x00007fff9819b368 in NSApplicationMain ()
#44 0x0000000100055252 in main
#45 0x0000000100001a24 in start ()

This issue has been probably been introduced when fixing or refactoring COUndoTrack.

I committed a fix that should solve your crash.

I fixed the localization issue with 5e02c70

CFBundleDevelopmentRegion was set to English, but Apple has changed the localization rules few years ago and language IDs must be used now.

I also updated ProjectDemo to use Base localization since that's the recommended practice.

Thanks! everything seems to be working in ProjectDemo