Changeset a9565f33d3e6742d5a18c8a0e6b8d811d95cc885

Show
Ignore:
Timestamp:
30/05/08 14:19:50 (4 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1212149990 +0200
git-parent:

[60d602251a048ac8160867a00a8f56165c5c34b2]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1212149882 +0200
Message:

objects: Make sure that we don't loose a vlc_object_kill() when attaching to a dead or dying parent.

Note: We do need to lock the parent for that.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/objects.c

    rdebed14 ra9565f3  
    838838    p_this->p_parent = p_parent; 
    839839 
     840    vlc_object_lock( p_this->p_parent ); 
     841 
    840842    /* Attach the child to its parent */ 
    841843    vlc_object_internals_t *priv = vlc_internals( p_parent ); 
    842844    INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children, 
    843845                 p_this ); 
     846 
     847    /* Kill the object if parent is already dead */ 
     848    if( !vlc_object_alive( p_this->p_parent) ) 
     849        vlc_object_kill( p_this ); 
     850 
     851    vlc_object_unlock( p_this->p_parent ); 
    844852 
    845853    vlc_mutex_unlock( &structure_lock );