Changeset 12599


Ignore:
Timestamp:
Jul 30, 2011, 12:11:29 AM (10 years ago)
Author:
livings124
Message:

slightly better locking in the file table

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileOutlineController.h

    r12571 r12599  
    3737    NSString * fFilterText;
    3838   
    39     NSLock * fLock;
     39    NSRecursiveLock * fLock;
    4040}
    4141
  • trunk/macosx/FileOutlineController.m

    r12571 r12599  
    7171   
    7272    #warning needed?
    73     fLock = [[NSLock alloc] init];
     73    fLock = [[NSRecursiveLock alloc] init];
    7474   
    7575    [self setTorrent: nil];
     
    110110- (void) setFilterText: (NSString *) text
    111111{
    112     [fLock lock];
    113    
    114112    if ([text isEqualToString: @""])
    115113        text = nil;
     
    117115    if ((!text && !fFilterText) || (text && fFilterText && [text isEqualToString: fFilterText]))
    118116    {
    119         [fLock unlock];
    120117        return;
    121118    }
     
    123120    const BOOL onLion = [NSApp isOnLionOrBetter];
    124121   
     122    [fLock lock];
     123   
    125124    if (onLion)
     125    {
     126        [[NSAnimationContext currentContext] setCompletionHandler: ^{ [fLock unlock]; NSLog(@"called"); }];
     127        [NSAnimationContext beginGrouping];
     128       
    126129        [fOutline beginUpdates];
     130    }
    127131   
    128132    NSUInteger currentIndex = 0, totalCount = 0;
     
    201205   
    202206    if (onLion)
     207    {
    203208        [fOutline endUpdates];
     209       
     210        [NSAnimationContext endGrouping];
     211    }
    204212    else
     213    {
    205214        [fOutline reloadData];
     215   
     216        [fLock unlock];
     217    }
    206218   
    207219    [fFilterText release];
    208220    fFilterText = [text retain];
    209    
    210     [fLock unlock];
    211221}
    212222
Note: See TracChangeset for help on using the changeset viewer.