Changeset c36f6582a09005300a78c70c28f530d1597ff262

Show
Ignore:
Timestamp:
05/30/07 14:47:26 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1180529246 +0000
git-parent:

[ddada0edf7b6aed7fd082e37d15d24689f0307d9]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1180529246 +0000
Message:

Fix memleaks and some cleanup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/osd/osd.c

    racc91d3 rc36f658  
    6666    vlc_mutex_lock( lockval.p_address ); 
    6767 
    68     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     68    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     69    if( p_osd == NULL ) 
    6970    { 
    7071        vlc_value_t val; 
     
    8990        p_osd->i_height = p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines; 
    9091 
    91         /* Update the volume state images to match the current volume */ 
    92         i_volume = config_GetInt( p_this, "volume" ); 
    93         i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges ); 
    94         p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( p_osd->p_state->p_volume->p_states, i_steps ); 
    95  
     92        if( p_osd->p_state->p_volume ) 
     93        { 
     94            /* Update the volume state images to match the current volume */ 
     95            i_volume = config_GetInt( p_this, "volume" ); 
     96            i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges ); 
     97            p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( 
     98                                    p_osd->p_state->p_volume->p_states, i_steps ); 
     99        } 
    96100        /* Initialize OSD state */ 
    97101        osd_UpdateState( p_osd->p_state, p_osd->i_x, p_osd->i_y, 
     
    199203    vlc_value_t lockval; 
    200204 
    201     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     205    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     206    if( p_osd == NULL ) 
    202207    { 
    203208        msg_Err( p_this, "osd_MenuNext failed" ); 
     
    240245    vlc_value_t lockval; 
    241246 
    242     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     247    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     248    if( p_osd == NULL ) 
    243249    { 
    244250        msg_Err( p_this, "osd_MenuNext failed" ); 
     
    267273    vlc_value_t lockval; 
    268274 
    269     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     275    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     276    if( p_osd == NULL ) 
    270277    { 
    271278        msg_Err( p_this, "osd_MenuNext failed" ); 
     
    329336    vlc_value_t lockval; 
    330337 
    331     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     338    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     339    if( p_osd == NULL ) 
    332340    { 
    333341        msg_Err( p_this, "osd_MenuNext failed" ); 
     
    379387    vlc_value_t lockval; 
    380388 
    381     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     389    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     390    if( p_osd == NULL ) 
    382391    { 
    383392        msg_Err( p_this, "osd_MenuPrev failed" ); 
     
    431440    vlc_value_t val; 
    432441#endif 
    433  
    434     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     442    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     443    if( p_osd == NULL ) 
    435444    { 
    436445        msg_Err( p_this, "osd_MenuDown failed" ); 
     
    503512#endif 
    504513 
    505     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     514    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     515    if( p_osd == NULL ) 
    506516    { 
    507517        msg_Err( p_this, "osd_MenuDown failed" ); 
     
    588598    int i_steps = 0; 
    589599 
    590     if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
     600    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); 
     601    if( p_osd == NULL ) 
    591602    { 
    592603        msg_Err( p_this, "OSD menu volume update failed" ); 
     
    594605    } 
    595606 
    596     var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); 
    597     vlc_mutex_lock( lockval.p_address ); 
    598  
    599     p_button = p_osd->p_state->p_volume; 
    600     if( p_osd->p_state->p_volume )  
    601         p_osd->p_state->p_visible = p_osd->p_state->p_volume; 
    602     if( p_button && p_button->b_range ) 
    603     { 
    604         /* Update the volume state images to match the current volume */ 
    605         i_volume = config_GetInt( p_this, "volume" ); 
    606         i_steps = osd_VolumeStep( p_this, i_volume, p_button->i_ranges ); 
    607         p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps ); 
    608  
    609         osd_UpdateState( p_osd->p_state, 
    610                 p_button->i_x, p_button->i_y, 
    611                 p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch, 
    612                 p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_lines, 
    613                 p_button->p_current_state->p_pic ); 
    614         osd_SetMenuUpdate( p_osd, VLC_TRUE ); 
    615         osd_SetMenuVisible( p_osd, VLC_TRUE ); 
    616     } 
    617     vlc_object_release( (vlc_object_t*) p_osd ); 
    618     vlc_mutex_unlock( lockval.p_address ); 
    619 
     607    if( p_osd->p_state && p_osd->p_state->p_volume ) 
     608    { 
     609        var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); 
     610        vlc_mutex_lock( lockval.p_address ); 
     611 
     612        p_button = p_osd->p_state->p_volume; 
     613        if( p_osd->p_state->p_volume )  
     614            p_osd->p_state->p_visible = p_osd->p_state->p_volume; 
     615        if( p_button && p_button->b_range ) 
     616        { 
     617            /* Update the volume state images to match the current volume */ 
     618            i_volume = config_GetInt( p_this, "volume" ); 
     619            i_steps = osd_VolumeStep( p_this, i_volume, p_button->i_ranges ); 
     620            p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps ); 
     621 
     622            osd_UpdateState( p_osd->p_state, 
     623                    p_button->i_x, p_button->i_y, 
     624                    p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch, 
     625                    p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_lines, 
     626                    p_button->p_current_state->p_pic ); 
     627            osd_SetMenuUpdate( p_osd, VLC_TRUE ); 
     628            osd_SetMenuVisible( p_osd, VLC_TRUE ); 
     629        } 
     630        vlc_object_release( (vlc_object_t*) p_osd ); 
     631        vlc_mutex_unlock( lockval.p_address ); 
     632    } 
     633
  • src/osd/osd_parser.c

    rafc8700 rc36f658  
    8989    p_menu->p_state = (osd_menu_state_t *) malloc( sizeof( osd_menu_state_t ) ); 
    9090    if( !p_menu->p_state ) 
     91    { 
    9192        msg_Err( p_menu, "Memory allocation for OSD Menu state failed" ); 
    92  
     93        return NULL; 
     94    } 
     95 
     96    memset(p_menu->p_state, 0, sizeof(osd_menu_state_t)); 
    9397    if( psz_path != NULL ) 
    9498        p_menu->psz_path = strdup( psz_path );