Changeset 13142


Ignore:
Timestamp:
Jan 8, 2012, 4:11:30 AM (10 years ago)
Author:
livings124
Message:

remove the no-longer-necessary lock from the file table

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileOutlineController.h

    r13129 r13142  
    3636   
    3737    NSString * fFilterText;
    38    
    39     NSRecursiveLock * fLock;
    4038}
    4139
  • trunk/macosx/FileOutlineController.m

    r13129 r13142  
    3333#import <Quartz/Quartz.h>
    3434
    35 #import "utils.h"
    36 
    3735#define ROW_SMALL_HEIGHT 18.0
    3836
     
    7371    [fOutline setMenu: [self menu]];
    7472   
    75     fLock = [[NSRecursiveLock alloc] init];
    76     [fLock setName: @"File Table"];
    77    
    7873    [self setTorrent: nil];
    7974}
     
    8479    [fFilterText release];
    8580   
    86     [fLock release];
    87    
    8881    [super dealloc];
    8982}
     
    10396    fFilterText = nil;
    10497   
    105     while (![fLock tryLock])
    106         tr_wait_msec(100);
    107    
    10898    [fOutline reloadData];
    10999    [fOutline deselectAll: nil]; //do this after reloading the data #4575
    110    
    111     [fLock unlock];
    112100}
    113101
     
    126114    const BOOL onLion = [NSApp isOnLionOrBetter];
    127115   
    128     while (![fLock tryLock])
    129         tr_wait_msec(100);
    130    
    131116    if (onLion)
    132     {
    133         [[NSAnimationContext currentContext] setCompletionHandler: ^{ [fLock unlock]; }];
    134         [NSAnimationContext beginGrouping];
    135        
    136117        [fOutline beginUpdates];
    137     }
    138118   
    139119    NSUInteger currentIndex = 0, totalCount = 0;
     
    223203   
    224204    if (onLion)
    225     {
    226205        [fOutline endUpdates];
    227        
    228         [NSAnimationContext endGrouping];
    229     }
    230206    else
    231     {
    232207        [fOutline reloadData];
    233    
    234         [fLock unlock];
    235     }
    236208   
    237209    [fFilterText release];
     
    243215    [fTorrent updateFileStat];
    244216   
    245     while (![fLock tryLock])
    246         tr_wait_msec(100);
    247    
    248217    [fOutline setNeedsDisplay: YES];
    249    
    250     [fLock unlock];
    251218}
    252219
     
    384351- (void) setCheck: (id) sender
    385352{
    386     while (![fLock tryLock])
    387         tr_wait_msec(100);
    388    
    389353    NSInteger state = [sender tag] == FILE_UNCHECK_TAG ? NSOffState : NSOnState;
    390354   
     
    396360    [fTorrent setFileCheckState: state forIndexes: itemIndexes];
    397361    [fOutline setNeedsDisplay: YES];
    398    
    399     [fLock unlock];
    400362}
    401363
    402364- (void) setOnlySelectedCheck: (id) sender
    403365{
    404     while (![fLock tryLock])
    405         tr_wait_msec(100);
    406    
    407366    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
    408367    NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
     
    417376   
    418377    [fOutline setNeedsDisplay: YES];
    419    
    420     [fLock unlock];
    421378}
    422379
     
    436393    }
    437394   
    438     while (![fLock tryLock])
    439         tr_wait_msec(100);
    440    
    441395    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
    442396    NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
     
    446400    [fTorrent setFilePriority: priority forIndexes: itemIndexes];
    447401    [fOutline setNeedsDisplay: YES];
    448    
    449     [fLock unlock];
    450402}
    451403
    452404- (void) revealFile: (id) sender
    453405{
    454     while (![fLock tryLock])
    455         tr_wait_msec(100);
    456    
    457406    NSIndexSet * indexes = [fOutline selectedRowIndexes];
    458407    NSMutableArray * paths = [NSMutableArray arrayWithCapacity: [indexes count]];
     
    466415    if ([paths count] > 0)
    467416        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: paths];
    468    
    469     [fLock unlock];
    470417}
    471418
Note: See TracChangeset for help on using the changeset viewer.