SFML community forums
Help => Window => Topic started by: msteele on November 24, 2011, 08:10:57 pm
-
Hello. I am just venturing into using SFML's network layer, but this problem is unrelated. Any call to sf::Keyboard::IsKeyPressed() causes a segfault. This started happening by itself, no code changes between when it was working and when it started segfaulting. I just recently installed SFML2 from github, but it did work with the new build for a while.
SFML2, just built from github (https://github.com/SFML/SFML)
OS X 10.6.8
(gdb) run
[a bunch of the usual "Could not find object file" for seemingly unrelated things]
.++++++................................................................................................ done
DEBUG: a
Reading symbols for shared libraries . done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000081000118
0x00007fff848944b7 in IOHIDDeviceGetValue ()
(gdb) backtrace
#0 0x00007fff848944b7 in IOHIDDeviceGetValue ()
#1 0x00000001000292e6 in sf::priv::HIDInputManager::IsKeyPressed ()
#2 0x0000000100027d7a in sf::priv::InputImpl::IsKeyPressed ()
#3 0x0000000100024589 in sf::Keyboard::IsKeyPressed ()
#4 0x0000000100001719 in main ()
(gdb)
Below is simpler code that fails for me in the same way.
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
int main (int argc, char **argv) {
std::cout << "DEBUG: a" << "\n";
sf::Keyboard::IsKeyPressed(sf::Keyboard::A);
std::cout << "DEBUG: b" << "\n";
}
Any ideas?
Thanks,
- Miles
-
put OS X in the subject.
-
runs fine on my computer.
make sure you don't have two different versions (headers/binaries) of SFML installed on your mac.
[a bunch of the usual "Could not find object file" for seemingly unrelated things]
These only appears when creating a "classic" application with the templates. If you create an application bundle you won't have any issue.
PS : as sbroadfoot90 said, putting OS X in the title helps me tracking the relevant messages on the forum.
-
I just had the same problem. I'm using OS X with SFML 2.0. There are definitely no other versions of SFML on my machine (I have only installed one version). My app was running fine and then, with no changes to the code, it started crashing in sf::Keyboard::IsKeyPressed().
One possible clue: I'm using the Apple wireless keyboard, and my batteries are getting low. I received a low battery warning around the time that this problem started happening. So I turned off the keyboard and installed new batteries. The problem remained, so I logged out and back in, and the problem was fixed.
So I'm not sure what the problem was exactly (batteries or something else), but there seems to be something keyboard-related that is reset when logging out and back in.