]> git.sesse.net Git - vlc/commitdiff
* src/misc/variables.c: fixed small mem leak (courtesy of Andy Lindsay)
authorGildas Bazin <gbazin@videolan.org>
Tue, 22 Jul 2003 15:59:06 +0000 (15:59 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 22 Jul 2003 15:59:06 +0000 (15:59 +0000)
* modules/gui/wxwindows/interface.cpp: small improvements to the volume control.

modules/gui/wxwindows/interface.cpp
src/misc/variables.c

index e9535567e055794df807f6edc7fde9ffaf8cdbf1..d2cc37cf0b0e1b53c8cf38f11ee00921f821048a 100644 (file)
@@ -2,7 +2,7 @@
  * interface.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.51 2003/07/20 20:33:17 gbazin Exp $
+ * $Id: interface.cpp,v 1.52 2003/07/22 15:59:06 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -113,6 +113,7 @@ private:
 BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
     /* Mouse events */
     EVT_LEFT_DOWN(wxVolCtrl::OnChange)
+    EVT_MOTION(wxVolCtrl::OnChange)
 END_EVENT_TABLE()
 
 /*****************************************************************************
@@ -853,7 +854,10 @@ wxVolCtrl::wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id )
 
 void wxVolCtrl::OnChange( wxMouseEvent& event )
 {
-    int i_volume = (GetRect().height - event.GetY()) * 200 / GetRect().height;
+    if( !event.LeftDown() && !event.LeftIsDown() ) return;
+
+    int i_volume = (GetClientSize().GetHeight() - event.GetY()) * 200 /
+                    GetClientSize().GetHeight();
     Change( i_volume );
 }
 
index 5ee9d2d59a4d986a0b62c10c152a910aff7468ea..7f2e46a0db76a02d1e44bd2d0035842bf18fcc28 100644 (file)
@@ -2,7 +2,7 @@
  * variables.c: routines for object variables handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: variables.c,v 1.26 2003/05/25 11:31:54 gbazin Exp $
+ * $Id: variables.c,v 1.27 2003/07/22 15:59:06 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -304,8 +304,11 @@ int __var_Destroy( vlc_object_t *p_this, const char *psz_name )
         for( i = 0 ; i < p_var->choices.i_count ; i++ )
         {
             p_var->pf_free( &p_var->choices.p_values[i] );
+            if( p_var->choices_text.p_values[i].psz_string )
+                free( p_var->choices_text.p_values[i].psz_string );
         }
         free( p_var->choices.p_values );
+        free( p_var->choices_text.p_values );
     }
 
     /* Free callbacks if needed */