1
General / Re: Exception thrown when attempting to run an SFML project
« on: April 17, 2020, 02:49:22 am »
It's due to that sf::Texture being global, it tries to access things that aren't ready yet when it's being constructed.
Although I can't now quickly find what code would fail (it might be loadExtensions at https://github.com/SFML/SFML/blob/master/src/SFML/Window/GlContext.cpp#L235 , it gets called eventually due to sf::Texture constructor being called, and it accesses globals, so there's the order conflict potential) or why and can't reproduce it but writing location 0x00000004 looks like attempt to write via pointer that's null.
Here's someone else's thread of similar issue years ago and answer is (and still is, I think) to not use globals because they might mess init order of SFML's own globals: https://en.sfml-dev.org/forums/index.php?topic=5654.0
Although I can't now quickly find what code would fail (it might be loadExtensions at https://github.com/SFML/SFML/blob/master/src/SFML/Window/GlContext.cpp#L235 , it gets called eventually due to sf::Texture constructor being called, and it accesses globals, so there's the order conflict potential) or why and can't reproduce it but writing location 0x00000004 looks like attempt to write via pointer that's null.
Here's someone else's thread of similar issue years ago and answer is (and still is, I think) to not use globals because they might mess init order of SFML's own globals: https://en.sfml-dev.org/forums/index.php?topic=5654.0