BGE: Fix for [#33839] "a logic.joysticks Crashes BGE" reported by Josiah Lane (solarlune).
On a scene change the SCA_JoystickManager gets destroyed which in turn means all of it's joystick instances are released. Since SCA_PythonJoystick was just using a borrowed reference, this allowed the joystick to be freed. Now the joystick's refcount is incremented so that the SCA_PythonJoystick's joystick reference will survive across scene changes.
This commit is contained in:
@@ -46,6 +46,10 @@ m_joystick(joystick)
|
||||
|
||||
SCA_PythonJoystick::~SCA_PythonJoystick()
|
||||
{
|
||||
// The joystick reference we got in the constructor was a new instance,
|
||||
// so we release it here
|
||||
m_joystick->ReleaseInstance();
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
PyDict_Clear(m_event_dict);
|
||||
Py_DECREF(m_event_dict);
|
||||
|
||||
Reference in New Issue
Block a user