mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:17:43 +02:00
Modifying SDL initialization due to crash on OSX
This commit is contained in:
parent
eb8b892571
commit
48b6586d01
1 changed files with 54 additions and 44 deletions
|
@ -54,6 +54,25 @@ SDL_JoystickID SDL2Manager::getInstanceId(SDL_GameController* controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL2Manager::init() {
|
void SDL2Manager::init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SDL2Manager::getSubdeviceNames() {
|
||||||
|
return _subdeviceNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDL2Manager::deinit() {
|
||||||
|
_openJoysticks.clear();
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SDL2Manager::activate() {
|
||||||
|
|
||||||
|
// FIXME for some reason calling this code in the `init` function triggers a crash
|
||||||
|
// on OSX in PR builds, but not on my local debug build. Attempting a workaround by
|
||||||
|
//
|
||||||
|
static std::once_flag once;
|
||||||
|
std::call_once(once, [&]{
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
auto preferences = DependencyManager::get<Preferences>();
|
auto preferences = DependencyManager::get<Preferences>();
|
||||||
|
@ -93,25 +112,16 @@ void SDL2Manager::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qDebug() << "Error initializing SDL2 Manager";
|
qDebug() << "Error initializing SDL2 Manager";
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!_isInitialized) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SDL2Manager::getSubdeviceNames() {
|
|
||||||
return _subdeviceNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDL2Manager::deinit() {
|
|
||||||
_openJoysticks.clear();
|
|
||||||
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SDL2Manager::activate() {
|
|
||||||
InputPlugin::activate();
|
InputPlugin::activate();
|
||||||
|
|
||||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||||
for (auto joystick : _openJoysticks) {
|
for (auto joystick : _openJoysticks) {
|
||||||
userInputMapper->registerDevice(joystick);
|
userInputMapper->registerDevice(joystick);
|
||||||
|
|
Loading…
Reference in a new issue