Fix bug when changing controller key to another subkey of the same key

This commit is contained in:
Ilari Liusvaara 2013-01-19 21:20:30 +02:00
parent e9a3787344
commit 6e013653cb

View file

@ -451,10 +451,10 @@ std::string controller_key::get_string() throw(std::bad_alloc)
void controller_key::set(keyboard_key* _key, unsigned _subkey) throw()
{
umutex_class u(mutex);
if(_key)
_key->add_listener(*this, false);
if(key)
key->remove_listener(*this);
if(key != _key) {
if(_key) _key->add_listener(*this, false);
if(key) key->remove_listener(*this);
}
key = _key;
subkey = _subkey;
}