Skip to content

Commit

Permalink
Reorder things a bit + add some comments.
Browse files Browse the repository at this point in the history
Fixes another crash that can occur when quitting the app.
  • Loading branch information
jpd002 committed Nov 9, 2023
1 parent be26fe8 commit bf72162
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/input/InputBindingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,18 @@ class CInputBindingManager
static uint32 m_buttonDefaultValue[PS2::CControllerInfo::MAX_BUTTONS];
static const char* m_padPreferenceName[MAX_PADS];

//Order of members is quite important here:
//- m_providersConnection should be last so that it can be destroyed first to avoid
// anything from calling into this (some providers run on threads) while dtor is running.
//- m_motorBindings needs to appear after m_providers. Motor bindings run threads
// that can push updates to input providers, so they need to be destroyed before.

ProviderMap m_providers;
ProviderConnectionMap m_providersConnection;

std::unique_ptr<CInputConfig> m_config;
std::array<float, MAX_PADS> m_analogSensitivity;
BindingPtr m_bindings[MAX_PADS][PS2::CControllerInfo::MAX_BUTTONS];
MotorBindingPtr m_motorBindings[MAX_PADS];

ProviderConnectionMap m_providersConnection;
};

0 comments on commit bf72162

Please sign in to comment.