]> git.sesse.net Git - vlc/commit
Remove a whole bunch of non-sensical vlc_object_hold()
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 16 Mar 2009 18:37:34 +0000 (20:37 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 16 Mar 2009 18:51:41 +0000 (20:51 +0200)
commitc3cffb4f2fc50e3d8d6078a93b32f7163cb54a7c
tree777ae304ca563e238bb6d75515dcdd6bbe963e20
parentd3a797fb4a5a3daf13a03e4d64f3812fccd84279
Remove a whole bunch of non-sensical vlc_object_hold()

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.
modules/gui/qt4/menus.cpp