Commit b8ed3905 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/wxwindows.cpp: include setlocale.h after the vlc headers.
* modules/gui/wxwindows/menus.cpp: fixed memory leaks.
* modules/gui/wxwindows/playlist.cpp: fixed deadlock.
parent 1babb275
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id: menus.cpp,v 1.32 2004/02/26 00:23:04 gbazin Exp $ * $Id: menus.cpp,v 1.33 2004/02/26 12:04:14 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -531,8 +531,6 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -531,8 +531,6 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL ); var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
var_Get( p_object, psz_var, &val );
if( i_type & VLC_VAR_HASCHOICE ) if( i_type & VLC_VAR_HASCHOICE )
{ {
menu->Append( MenuDummy_Event, menu->Append( MenuDummy_Event,
...@@ -548,6 +546,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -548,6 +546,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_VOID: case VLC_VAR_VOID:
var_Get( p_object, psz_var, &val );
menuitem = new wxMenuItemExt( menu, ++i_item_id, menuitem = new wxMenuItemExt( menu, ++i_item_id,
wxU(text.psz_string ? wxU(text.psz_string ?
text.psz_string : psz_var), text.psz_string : psz_var),
...@@ -557,6 +556,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -557,6 +556,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
break; break;
case VLC_VAR_BOOL: case VLC_VAR_BOOL:
var_Get( p_object, psz_var, &val );
val.b_bool = !val.b_bool; val.b_bool = !val.b_bool;
menuitem = new wxMenuItemExt( menu, ++i_item_id, menuitem = new wxMenuItemExt( menu, ++i_item_id,
wxU(text.psz_string ? wxU(text.psz_string ?
...@@ -566,13 +566,8 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -566,13 +566,8 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
menu->Append( menuitem ); menu->Append( menuitem );
Check( i_item_id, val.b_bool ? FALSE : TRUE ); Check( i_item_id, val.b_bool ? FALSE : TRUE );
break; break;
default:
if( text.psz_string ) free( text.psz_string );
return;
} }
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
if( text.psz_string ) free( text.psz_string ); if( text.psz_string ) free( text.psz_string );
} }
...@@ -601,15 +596,9 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object, ...@@ -601,15 +596,9 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
return NULL; return NULL;
} }
if( var_Get( p_object, psz_var, &val ) < 0 )
{
return NULL;
}
if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
&val_list, &text_list ) < 0 ) &val_list, &text_list ) < 0 )
{ {
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
return NULL; return NULL;
} }
...@@ -632,6 +621,8 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object, ...@@ -632,6 +621,8 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
break; break;
case VLC_VAR_STRING: case VLC_VAR_STRING:
var_Get( p_object, psz_var, &val );
another_val.psz_string = another_val.psz_string =
strdup(val_list.p_list->p_values[i].psz_string); strdup(val_list.p_list->p_values[i].psz_string);
menuitem = menuitem =
...@@ -646,13 +637,17 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object, ...@@ -646,13 +637,17 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
menu->Append( menuitem ); menu->Append( menuitem );
if( !(i_type & VLC_VAR_ISCOMMAND) && if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string &&
!strcmp( val.psz_string, !strcmp( val.psz_string,
val_list.p_list->p_values[i].psz_string ) ) val_list.p_list->p_values[i].psz_string ) )
menu->Check( i_item_id, TRUE ); menu->Check( i_item_id, TRUE );
if( val.psz_string ) free( val.psz_string );
break; break;
case VLC_VAR_INTEGER: case VLC_VAR_INTEGER:
var_Get( p_object, psz_var, &val );
menuitem = menuitem =
new wxMenuItemExt( menu, ++i_item_id, new wxMenuItemExt( menu, ++i_item_id,
text_list.p_list->p_values[i].psz_string ? text_list.p_list->p_values[i].psz_string ?
...@@ -679,7 +674,6 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object, ...@@ -679,7 +674,6 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
} }
/* clean up everything */ /* clean up everything */
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list ); var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
return menu; return menu;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id: playlist.cpp,v 1.45 2004/02/26 08:24:29 gbazin Exp $ * $Id: playlist.cpp,v 1.46 2004/02/26 12:04:14 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -541,11 +541,11 @@ void Playlist::UpdatePlaylist() ...@@ -541,11 +541,11 @@ void Playlist::UpdatePlaylist()
} }
/* Update the colour of items */ /* Update the colour of items */
vlc_mutex_lock( &p_playlist->object_lock ); int i_playlist_index = p_playlist->i_index;
if( p_intf->p_sys->i_playing != p_playlist->i_index ) if( p_intf->p_sys->i_playing != i_playlist_index )
{ {
wxListItem listitem; wxListItem listitem;
listitem.m_itemId = p_playlist->i_index; listitem.m_itemId = i_playlist_index;
listitem.SetTextColour( *wxRED ); listitem.SetTextColour( *wxRED );
listview->SetItem( listitem ); listview->SetItem( listitem );
...@@ -555,9 +555,8 @@ void Playlist::UpdatePlaylist() ...@@ -555,9 +555,8 @@ void Playlist::UpdatePlaylist()
listitem.SetTextColour( *wxBLACK ); listitem.SetTextColour( *wxBLACK );
listview->SetItem( listitem ); listview->SetItem( listitem );
} }
p_intf->p_sys->i_playing = p_playlist->i_index; p_intf->p_sys->i_playing = i_playlist_index;
} }
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id: wxwindows.cpp,v 1.38 2004/01/25 03:29:02 hartman Exp $ * $Id: wxwindows.cpp,v 1.39 2004/02/26 12:04:14 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <stdio.h> #include <stdio.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
# include <locale.h> # include <locale.h>
#endif #endif
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "wxwindows.h" #include "wxwindows.h"
/* Temporary hack */ /* Temporary hack */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment