Changeset 2b5eb3185ecd05444ce310ec33e0fdc0e5e69c90

Show
Ignore:
Timestamp:
05/07/08 20:37:29 (2 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210185449 +0300
git-parent:

[77bea3492049ad6989b04779d259fa27ed72a2e9]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210185449 +0300
Message:

Don't reregister the same callbacks over and over again

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/ncurses.c

    rd1aff39 r2b5eb31  
    109109 
    110110static void start_color_and_pairs ( intf_thread_t * ); 
     111static playlist_t *pl_Get( intf_thread_t *p_intf ) 
     112{ 
     113    return p_intf->p_sys->p_playlist; 
     114} 
    111115 
    112116/***************************************************************************** 
     
    181185{ 
    182186    input_thread_t *p_input; 
     187    playlist_t     *p_playlist; 
    183188 
    184189    bool      b_color; 
     
    336341    intf_thread_t *p_intf = (intf_thread_t *)p_this; 
    337342    intf_sys_t    *p_sys = p_intf->p_sys; 
    338     playlist_t    *p_playlist = pl_Get( p_intf ); 
    339343    int i; 
    340  
    341     var_DelCallback( p_playlist, "intf-change", PlaylistChanged, p_intf ); 
    342     var_DelCallback( p_playlist, "item-append", PlaylistChanged, p_intf ); 
    343344 
    344345    PlaylistDestroy( p_intf ); 
     
    385386    intf_sys_t    *p_sys = p_intf->p_sys; 
    386387    playlist_t    *p_playlist = pl_Yield( p_intf ); 
     388    p_sys->p_playlist = p_playlist; 
    387389 
    388390    int i_key; 
     
    397399     */ 
    398400    PlaylistRebuild( p_intf ); 
     401    var_AddCallback( p_playlist, "intf-change", PlaylistChanged, p_intf ); 
     402    var_AddCallback( p_playlist, "item-append", PlaylistChanged, p_intf ); 
    399403 
    400404    while( !intf_ShouldDie( p_intf ) ) 
     
    403407 
    404408        /* Update the input */ 
    405         var_AddCallback( p_playlist, "intf-change", PlaylistChanged, p_intf ); 
    406         var_AddCallback( p_playlist, "item-append", PlaylistChanged, p_intf ); 
    407  
    408409        PL_LOCK; 
    409410        if( p_sys->p_input == NULL ) 
     
    459460        } 
    460461    } 
     462    var_DelCallback( p_playlist, "intf-change", PlaylistChanged, p_intf ); 
     463    var_DelCallback( p_playlist, "item-append", PlaylistChanged, p_intf ); 
    461464} 
    462465