diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-01-12 09:44:08 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-01-12 09:44:08 +0400 |
commit | 03df7e9a564d1ba6366b5d6b587b9319158ca198 (patch) | |
tree | 13e6ac427d2f5171998c3cff47c1b87d90ddbed1 /source/gameengine/GameLogic | |
parent | 2f4cc3530da0496b58a856849bd9fc6954e138be (diff) |
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.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonJoystick.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp index 8c0a0c5ae33..9b24ad7bcf2 100644 --- a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp +++ b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp @@ -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); |