Skip to content

Commit

Permalink
Fix a crash on macos when SFML is not called enough? Really weird one…
Browse files Browse the repository at this point in the history
… tbh
  • Loading branch information
pierr3 committed May 9, 2024
1 parent c2dce0c commit f347488
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/src/InputHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ void InputHandler::onTimer(Poco::Timer& /*timer*/)
{
sf::Joystick::update();

// Strangely, if you don't call this every time, SFML will just crash?
sf::Keyboard::isKeyPressed(sf::Keyboard::Scancode::Unknown);

std::lock_guard<std::mutex> lock(m);
if (isPttSetupRunning) {

// Check for Key presses
for (int i = sf::Keyboard::Scancode::A; i < sf::Keyboard::Scancode::ScancodeCount; i++) {
if (sf::Keyboard::isKeyPressed(static_cast<sf::Keyboard::Scancode>(i))) {
TRACK_LOG_INFO("Ptt Key set: {}", i);
updatePttKey(i, false);

isPttSetupRunning = false;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f347488

Please sign in to comment.