[vlc-devel] commit: interaction: fix signal leak ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 31 17:59:27 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat May 31 18:26:07 2008 +0300| [a3069143195fc51aecced37fef9725c0f8acb9dd]

interaction: fix signal leak

There is no point in unlocking and locking again immediatly.
Not only will this typically fail to yield the CPU to another would-be
waiting thread, but vlc_object_wait() will unlock&lock anyway.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3069143195fc51aecced37fef9725c0f8acb9dd
---

 src/interface/interaction.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/interface/interaction.c b/src/interface/interaction.c
index 4068f91..8a302c8 100644
--- a/src/interface/interaction.c
+++ b/src/interface/interaction.c
@@ -535,17 +535,13 @@ static void InteractionLoop( vlc_object_t *p_this )
     int i;
     interaction_t *p_interaction = (interaction_t*) p_this;
 
-    while( !p_this->b_die )
+    vlc_object_lock( p_this );
+    while( vlc_object_alive( p_this ) )
     {
-        vlc_object_lock( p_this );
-        if( vlc_object_wait( p_this ) )
-        {
-            vlc_object_unlock( p_this );
-            break;
-        }
         InteractionManage( p_interaction );
-        vlc_object_unlock( p_this );
+        vlc_object_wait( p_this );
     }
+    vlc_object_unlock( p_this );
 
     /* Remove all dialogs - Interfaces must be able to clean up their data */
     for( i = p_interaction->i_dialogs -1 ; i >= 0; i-- )




More information about the vlc-devel mailing list