Skip to content

Commit 6f2e562

Browse files
committed
Put Help Book back to the original structure, since I changed my mind and decided to have one combined Help Book for all 4 apps.
Fixed Worker behavior when doc alias fails.
1 parent a650dd8 commit 6f2e562

File tree

3 files changed

+102
-2
lines changed

3 files changed

+102
-2
lines changed

SSYDropboxGuy.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ + (BOOL)pathIsInDropbox:(NSString*)path {
255255
// on my old 32-bit Mac Mini, path will at this point be instead
256256
// /Users/jk/Cloud/dropbox/dropbox/DeleteTest.bkmslf. The same
257257
// thing happens in BookMacster-Worker, where the path is obtained
258-
// from -[BkmxDocumentController pathOfDocumentWithUuid::::], which
258+
// from -[BkmxDocumentController pathOfDocumentWithUuid:::::], which
259259
// gets it from a stored alias record.
260260
// So if that didn't work, we morph and retest it.
261261
NSMutableString* morphedPath = [path mutableCopy] ;

SSYManagedObject.m

+100
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,106 @@ - (NSUInteger)countOfNonNilValues {
417417
return count ;
418418
}
419419

420+
#if 0
421+
#warning Testing snapshot events
422+
423+
+ (NSCountedSet*)awakenedObjects {
424+
NSCountedSet* awakenedObjects = ssyDebugGlobalObject ;
425+
if (!awakenedObjects) {
426+
awakenedObjects = [[NSCountedSet alloc] init] ;
427+
ssyDebugGlobalObject = awakenedObjects ;
428+
NSLog(@"awakenedObjects = %p", awakenedObjects) ;
429+
}
430+
431+
return awakenedObjects ;
432+
}
433+
434+
- (void)addAwakenedObject:(SSYManagedObject*)object {
435+
[[[self class] awakenedObjects] addObject:object] ;
436+
}
437+
438+
- (void)removeAwakenedObject:(SSYManagedObject*)object {
439+
[[[self class] awakenedObjects] removeObject:object] ;
440+
}
441+
442+
+ (void)logAwakenedObjects {
443+
NSCountedSet* awakenedObjects = [self awakenedObjects] ;
444+
for (id object in awakenedObjects) {
445+
printf("cnt=%02ld flt=%hhd del=%hhd rc=%ld %p %s\n",
446+
(long)[awakenedObjects countForObject:object],
447+
[object isFault],
448+
[object isDeleted],
449+
[object retainCount],
450+
object,
451+
[[object className] UTF8String]) ;
452+
}
453+
}
454+
455+
- (void)awakeFromInsert {
456+
[self addAwakenedObject:self] ;
457+
[super awakeFromInsert] ;
458+
}
459+
460+
- (void)awakeFromFetch {
461+
[self addAwakenedObject:self] ;
462+
[super awakeFromFetch];
463+
}
464+
465+
- (void)willTurnIntoFault {
466+
[self removeAwakenedObject:self] ;
467+
[super willTurnIntoFault];
468+
}
469+
470+
- (NSString*)eventDescriptionForFlags:(NSSnapshotEventType)flags {
471+
NSMutableString* eventsString = [[NSMutableString alloc] init] ;
472+
if ((flags & NSSnapshotEventUndoInsertion) != 0) {
473+
[eventsString appendString:@"+UndoInsert"] ;
474+
}
475+
if ((flags & NSSnapshotEventUndoDeletion) != 0) {
476+
[eventsString appendString:@"+UndoDelete"] ;
477+
}
478+
if ((flags & NSSnapshotEventUndoUpdate) != 0) {
479+
[eventsString appendString:@"+UndoUpdate"] ;
480+
}
481+
if ((flags & NSSnapshotEventRollback) != 0) {
482+
[eventsString appendString:@"+Rollback"] ;
483+
}
484+
if ((flags & NSSnapshotEventRefresh) != 0) {
485+
[eventsString appendString:@"+Refresh"] ;
486+
}
487+
if ((flags & NSSnapshotEventMergePolicy) != 0) {
488+
[eventsString appendString:@"+MergePolicy"] ;
489+
}
490+
491+
NSEntityDescription* entityDescription = [[self class] entityDescription] ;
492+
NSArray* attributeKeys = [[entityDescription attributesByName] allKeys] ;
493+
494+
NSInteger nonNils = 0 ;
495+
for (NSString* key in attributeKeys) {
496+
if ([self valueForKeyPath:key]) {
497+
nonNils++ ;
498+
}
499+
}
500+
501+
NSString* answer = [[NSString alloc] initWithFormat:
502+
@"%@ %ld/%ld values/keys %@",
503+
[self className],
504+
(long)nonNils,
505+
(long)[attributeKeys count],
506+
eventsString] ;
507+
[eventsString release] ;
508+
509+
return [answer autorelease] ;
510+
}
511+
512+
- (void)awakeFromSnapshotEvents:(NSSnapshotEventType)flags {
513+
NSLog(@"awakeSshot %p %@ %@", self, [self className], [self eventDescriptionForFlags:flags]) ;
514+
[super awakeFromSnapshotEvents:flags ] ;
515+
}
516+
517+
#endif
518+
519+
420520
#if 0
421521
#warning Overrode SSYManagedObject -dealloc and -didTurnIntoFault for debug logging
422522
- (void)dealloc {

SSYWindowHangout.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ - (void)windowDidCloseNote:(NSNotification*)note {
4040
controllers would be deallocated immediately. Originally, I thought that
4141
it was good defensive programming, but in fact there is no need for it,
4242
and the delayed deallocation can cause, for example, observers to hang
43-
on longer than necessary, causing trouble when things are town down.
43+
on longer than necessary, causing trouble when things are torn down.
4444
*/
4545
//[[self retain] autorelease] ;
4646

0 commit comments

Comments
 (0)