From f0dc54ba5d8a5219692b5fac17fe26a4eb11eadd Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Thu, 10 May 2007 12:24:23 +0000 Subject: [PATCH] Mac OS X gui: Fix a crash when waking up from sleep. --- modules/gui/macosx/playlist.m | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index 144f2682a4..0d0b5450d6 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -237,15 +237,37 @@ { id o_value = nil; playlist_item_t *p_item; - - if( item == nil || ![item isKindOfClass: [NSValue class]] ) return( @"error" ); + + /* For error handling */ + static BOOL attempted_reload = NO; + + if( item == nil || ![item isKindOfClass: [NSValue class]] ) + { + /* Attempt to fix the error by asking for a data redisplay + * This might cause infinite loop, so add a small check */ + if( !attempted_reload ) + { + attempted_reload = YES; + [outlineView reloadData]; + } + return @"error" ; + } p_item = (playlist_item_t *)[item pointerValue]; - if( p_item == NULL ) + if( !p_item || !p_item->p_input ) { - return( @"error"); + /* Attempt to fix the error by asking for a data redisplay + * This might cause infinite loop, so add a small check */ + if( !attempted_reload ) + { + attempted_reload = YES; + [outlineView reloadData]; + } + return @"error"; } + attempted_reload = NO; + if( [[o_tc identifier] isEqualToString:@"1"] ) { /* sanity check to prevent the NSString class from crashing */ -- 2.39.2