Changeset 3471

Show
Ignore:
Timestamp:
12/17/06 22:35:56 (2 years ago)
Author:
timothy
Message:

Adds a safe guard to prevent the chat window from 'freezing' and not updating it's display until minimized. Also some code clean up. #940

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Controllers/JVChatWindowController.m

    r3470 r3471  
    984984 
    985985- (void) _refreshWindow { 
     986        id item = [self selectedListItem]; 
     987        if( ! item ) return; 
     988 
    986989        [[self window] disableFlushWindow]; 
    987  
    988         id item = [self selectedListItem]; 
    989         if( ! item ) goto end; 
    990990 
    991991        if( ( [item conformsToProtocol:@protocol( JVChatViewController )] && item != (id) _activeViewController ) || ( ! _activeViewController && [[item parent] conformsToProtocol:@protocol( JVChatViewController )] && ( item = [item parent] ) ) ) { 
     
    10211021        [self _refreshWindowTitle]; 
    10221022 
    1023 end: 
    1024         [[self window] enableFlushWindow]; 
     1023        if( [[self window] isFlushWindowDisabled] ) 
     1024               [[self window] enableFlushWindow]; 
    10251025        [[self window] displayIfNeeded]; 
    10261026} 
  • trunk/Controllers/JVSidebarChatWindowController.m

    r3462 r3471  
    7171 
    7272- (void) _refreshWindow { 
     73        id item = [self selectedListItem]; 
     74        if( ! item ) return; 
     75 
    7376        [[self window] disableFlushWindow]; 
    74  
    75         id item = [self selectedListItem]; 
    76         if( ! item ) goto end; 
    7777 
    7878        if( ( [item conformsToProtocol:@protocol( JVChatViewController )] && item != (id) _activeViewController ) || ( ! _activeViewController && [[item parent] conformsToProtocol:@protocol( JVChatViewController )] && ( item = [item parent] ) ) ) { 
     
    111111        [self _refreshWindowTitle]; 
    112112 
    113 end: 
    114         [[self window] enableFlushWindow]; 
     113        if( [[self window] isFlushWindowDisabled] ) 
     114               [[self window] enableFlushWindow]; 
    115115        [[self window] displayIfNeeded]; 
    116116} 
  • trunk/Controllers/JVTabbedChatWindowController.m

    r3462 r3471  
    529529        [tabView setNeedsDisplay:YES]; 
    530530 
    531         [[self window] enableFlushWindow]; 
     531        if( [[self window] isFlushWindowDisabled] ) 
     532                [[self window] enableFlushWindow]; 
    532533        [[self window] displayIfNeeded]; 
    533534 
     
    537538 
    538539- (void) _refreshWindow { 
     540        id item = [(JVChatTabItem *)[tabView selectedTabViewItem] chatViewController]; 
     541        if( ! item ) return; 
     542 
    539543        [[self window] disableFlushWindow]; 
    540  
    541         id item = [(JVChatTabItem *)[tabView selectedTabViewItem] chatViewController]; 
    542         if( ! item ) goto end; 
    543544 
    544545        if( ( [item conformsToProtocol:@protocol( JVChatViewController )] && item != (id) _activeViewController ) || ( ! _activeViewController && [[item parent] conformsToProtocol:@protocol( JVChatViewController )] && ( item = [item parent] ) ) ) { 
     
    570571        [self _refreshWindowTitle]; 
    571572 
    572 end: 
    573         [[self window] enableFlushWindow]; 
     573        if( [[self window] isFlushWindowDisabled] ) 
     574               [[self window] enableFlushWindow]; 
    574575        [[self window] displayIfNeeded]; 
    575576} 
  • trunk/Panels/JVChatConsolePanel.m

    r3470 r3471  
    490490 
    491491        [splitView setNeedsDisplay:YES]; // makes the divider redraw correctly later 
    492         [[display window] enableFlushWindow]; // flush everything we have drawn 
     492        if( [[display window] isFlushWindowDisabled] ) 
     493                [[display window] enableFlushWindow]; // flush everything we have drawn 
    493494        [[display window] displayIfNeeded]; 
    494495} 
  • trunk/Panels/JVDirectChatPanel.m

    r3470 r3471  
    12111211 
    12121212        [splitView setNeedsDisplay:YES]; // makes the divider redraw correctly later 
    1213         [[display window] enableFlushWindow]; // flush everything we have drawn 
     1213        if( [[display window] isFlushWindowDisabled] ) 
     1214                [[display window] enableFlushWindow]; // flush everything we have drawn 
    12141215        [[display window] displayIfNeeded]; 
    12151216} 
  • trunk/Preferences/JVAppearancePreferences.m

    r3460 r3471  
    9999 
    100100#pragma mark - 
    101  
    102 - (void) awakeFromNib { 
    103         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( styleDidReload: ) name:JVStyleViewDidChangeStylesNotification object:preview]; 
    104 } 
    105101 
    106102- (void) initializeFromDefaults { 
     
    291287- (void) updateVariant { 
    292288        [preview setStyleVariant:[_style defaultVariantName]]; 
    293  
    294         if( [[preview window] isFlushWindowDisabled] ) [[preview window] enableFlushWindow]; 
    295  
    296         [[preview window] disableFlushWindow]; 
    297289        [preview reloadCurrentStyle]; 
    298 } 
    299  
    300 - (void) styleDidReload:(NSNotification *) notification { 
    301         if( [[preview window] isFlushWindowDisabled] ) [[preview window] enableFlushWindow]; 
    302         [[preview window] displayIfNeeded]; 
    303290} 
    304291 
  • trunk/Views/JVStyleView.m

    r3460 r3471  
    502502                } 
    503503 
    504                 [_domDocument autorelease]
     504                id old = _domDocument
    505505                _domDocument = (DOMHTMLDocument *)[[frame DOMDocument] retain]; 
    506  
    507                 [_body autorelease]; 
     506                [old release]; 
     507 
     508                old = _body; 
    508509                _body = (DOMHTMLElement *)[[_domDocument getElementById:@"contents"] retain]; 
    509510                if( ! _body ) _body = (DOMHTMLElement *)[[_domDocument body] retain]; 
     511                [old release]; 
    510512 
    511513                [self performSelector:@selector( _checkForTransparantStyle ) withObject:nil afterDelay:0.]; 
     
    515517                [self clearScrollbarMarks]; 
    516518 
    517                 if( [[self window] isFlushWindowDisabled] ) [[self window] enableFlushWindow]; 
     519                [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector( _enableFlushWindowTimeout ) object:nil]; 
     520 
     521                if( [[self window] isFlushWindowDisabled] ) 
     522                        [[self window] enableFlushWindow]; 
    518523                [[self window] displayIfNeeded]; 
    519524 
     
    665670 
    666671        [[self window] disableFlushWindow]; 
     672        [self performSelector:@selector( _enableFlushWindowTimeout ) withObject:nil afterDelay:2.]; 
    667673 
    668674        if( _mainFrameReady ) { 
     
    674680                [[self mainFrame] loadRequest:request]; 
    675681        } 
     682} 
     683 
     684- (void) _enableFlushWindowTimeout { 
     685        if( [[self window] isFlushWindowDisabled] ) 
     686                [[self window] enableFlushWindow]; 
    676687} 
    677688