Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Segmentation Fault - SFML2  (Read 12260 times)

0 Members and 1 Guest are viewing this topic.

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Segmentation Fault - SFML2
« Reply #15 on: August 02, 2012, 04:44:34 pm »
I don't know the context in which the GlobalDisplay instance is used well enough, but I'd either use some kind of lazy initialization method (like a Singleton), or have the user call an init() function manually, like SDL does. The latter would be my preferred route, although I'm a aware that's it's slightly opposed to the way your API is designed. I'd be happy with the Singleton, as long as it's a private interface, just the way it is now. One of the most basic C/C++ idioms should apply here, "you don't have to pay for what you don't use".

To fix the X11 stuff, I suggest a shutdown() function, which is responsible for destroying all SFML instances which are still alive. This is probably hard to implement in a clean way, but it would give users a surefire way to force all system calls to complete just before the end of main(), and to avoid the undeterministic static deinitialization mayhem.

Hopefully that did make sense...
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Segmentation Fault - SFML2
« Reply #16 on: August 02, 2012, 05:04:52 pm »
In fact the init/cleanup functions are probably the only solution to this kind of problem. But, of course, I'd like to avoid them :)
Laurent Gomila - SFML developer

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Segmentation Fault - SFML2
« Reply #17 on: January 13, 2014, 12:22:39 pm »
I hate to necro this thread again, but I'm running into the same error (without a segfault).

Checking my /var/log/Xorg.0.log file, this shows up every crash, and is right after X start up stuff, and before X closes (because of the crash):
"WaitForSomething(): select: Invalid argument"

Googling "WaitForSomething()" comes up with people reporting the same error, for different reasons though. Though I did learn that it's a function used in X.

I've gotten the same error multiple times, though the application usually runs for a variable amount of time before X crashes.

Got the same crash when running this: http://www.ludumdare.com/compo/ludum-dare-28/?action=preview&uid=24781

SFML version: 2.1.0.4a300547f3-1 (appears to be the latest github commit)

System:
Arch Linux
Kernel: 3.12.6-1-ck x86_64
Window Manager: Openbox
X.org X Server: 1.14.5
Mesa Drivers: 10.0.2-1
« Last Edit: January 15, 2014, 01:00:22 am by dabbertorres »

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Segmentation Fault - SFML2
« Reply #18 on: January 15, 2014, 01:00:34 am »
After doing some more digging around, it turns out it is a Kernel/X issue.

So far seems to be fixed after having upgraded to Kernel 3.12.7 and X.org 1.15.0.
« Last Edit: January 15, 2014, 06:33:55 am by dabbertorres »

 

anything