fix stale INPUTMAN pointer in Lua after device change

This commit is contained in:
Glenn Maynard
2005-12-18 21:24:33 +00:00
parent 636369ba4b
commit e9ffd980f0
3 changed files with 19 additions and 7 deletions
+16 -5
View File
@@ -12,12 +12,9 @@ RageInput::RageInput( CString sDriverList )
{
LOG->Trace( "RageInput::RageInput()" );
/* Init optional devices. */
MakeInputHandlers( sDriverList, m_pDevices );
m_sDriverList = sDriverList;
/* If no input devices are loaded, the user won't be able to input anything. */
if( m_pDevices.size() == 0 )
LOG->Warn( "No input devices were loaded." );
LoadDrivers();
}
RageInput::~RageInput()
@@ -27,6 +24,20 @@ RageInput::~RageInput()
delete m_pDevices[i];
}
void RageInput::LoadDrivers()
{
for( unsigned i = 0; i < m_pDevices.size(); ++i )
delete m_pDevices[i];
m_pDevices.clear();
/* Init optional devices. */
MakeInputHandlers( m_sDriverList, m_pDevices );
/* If no input devices are loaded, the user won't be able to input anything. */
if( m_pDevices.size() == 0 )
LOG->Warn( "No input devices were loaded." );
}
void RageInput::Update( float fDeltaTime )
{
/* Update optional devices. */