• Rémi Denis-Courmont's avatar
    Remove a whole bunch of non-sensical vlc_object_hold() · c3cffb4f
    Rémi Denis-Courmont authored
    In one case (noted by Erwan Tulou), this also fixes a large leak.
    
    There is _absolutely_ no point in holding an object and releasing it
    immediately. Holding an object only makes sense if:
     - the object cannot vanish while calling vlc_object_hold(), and
     - either:
       - the object could have otherwise vanished before
         vlc_object_release(), or
       - there is no way to avoid the (otherwise not needed)
         vlc_object_hold() because it comes from another component.
    
    Conversely, it makes no sense to hold an object, if:
     - it could vanish already while calling hold (race condition)
       -> this is *invalid* and might crash,
     - there is already a valid reference to the object throughout.
    
    I don't know in which case that code was, but the popup menu definitely
    does invalid object access in some cases. For instance:
     - start playing a single video,
     - seek to a few seconds before the end,
     - open the popup menu, go to video / deinterlace,
     - wait for the video to finish and the playlist to stop,
     - click on "X" from the deinterlace submenu.
    Oops.
    c3cffb4f
menus.cpp 42.7 KB