Bonjour,
Depuis quelques temps j'ai un problème. Je suis sous Manjaro Linux, et je développe un jeu avec sfml.
Mon problème est un crash, avec une sortie sigabrt, lors de l'appel de fonctions comme waitEvent() ou Keyboard::isKeyPressed(). Quand je lance le jeu, le crash est assez aléatoire : on peut le lancer plusieurs fois sans problèmes, mais parfois il ne se lance plus, crashant a chaque fois. En utilisant valgrind, ça crash systematiquement.
Si vous voulez le code source, il est sur github (
http://github.com/jlppc/OpMon). Le code est assez mal organisé, mais on m'a offert des conseils que je suis en train d'appliquer, petit à petit, pour mieux l'organiser.
Voici la sortie de valgrind :
==6314== Memcheck, a memory error detector
==6314== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6314== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==6314== Command: ./OpMon
==6314==
==6314== Thread 4:
==6314== Invalid read of size 4
==6314== at 0x6B7147D: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F3542: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5038: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6BD: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x50916E5: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509199D: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75076: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75101: sf::Texture::create(unsigned int, unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75A25: sf::Texture::loadFromImage(sf::Image const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75BCF: sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== Address 0xd115c60 is 16 bytes inside a block of size 24 free'd
==6314== at 0x4C2E14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B7162F: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B5779D: XGetWindowProperty (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B56442: XGetWMHints (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x509BC49: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509C46A: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5096889: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5095402: sf::Window::waitEvent(sf::Event&) (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x179126: MainMenu::boucle0() (MainMenu.cpp:88)
==6314== by 0x1794E1: MainMenu::mainMenu() (MainMenu.cpp:164)
==6314== by 0x174CA6: MainFrame::open() (MainFrame.cpp:160)
==6314== by 0x1B4969: Main::starts() (main.cpp:118)
==6314== Block was alloc'd at
==6314== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B708D5: ??? (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B71457: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F2F2C: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F36BC: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5009: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6FC: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091672: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091856: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75045: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314==
==6314== Invalid write of size 4
==6314== at 0x6B714B0: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F3542: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5038: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6BD: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x50916E5: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509199D: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75076: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75101: sf::Texture::create(unsigned int, unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75A25: sf::Texture::loadFromImage(sf::Image const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75BCF: sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== Address 0xd115c60 is 16 bytes inside a block of size 24 free'd
==6314== at 0x4C2E14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B7162F: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B5779D: XGetWindowProperty (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B56442: XGetWMHints (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x509BC49: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509C46A: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5096889: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5095402: sf::Window::waitEvent(sf::Event&) (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x179126: MainMenu::boucle0() (MainMenu.cpp:88)
==6314== by 0x1794E1: MainMenu::mainMenu() (MainMenu.cpp:164)
==6314== by 0x174CA6: MainFrame::open() (MainFrame.cpp:160)
==6314== by 0x1B4969: Main::starts() (main.cpp:118)
==6314== Block was alloc'd at
==6314== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B708D5: ??? (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B71457: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F2F2C: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F36BC: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5009: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6FC: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091672: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091856: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75045: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314==
==6314== Invalid read of size 8
==6314== at 0x6B714C9: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F3542: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5038: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6BD: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x50916E5: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509199D: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75076: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75101: sf::Texture::create(unsigned int, unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75A25: sf::Texture::loadFromImage(sf::Image const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== by 0x4E75BCF: sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314== Address 0xd115c58 is 8 bytes inside a block of size 24 free'd
==6314== at 0x4C2E14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B7162F: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B5779D: XGetWindowProperty (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B56442: XGetWMHints (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x509BC49: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x509C46A: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5096889: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5095402: sf::Window::waitEvent(sf::Event&) (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x179126: MainMenu::boucle0() (MainMenu.cpp:88)
==6314== by 0x1794E1: MainMenu::mainMenu() (MainMenu.cpp:164)
==6314== by 0x174CA6: MainFrame::open() (MainFrame.cpp:160)
==6314== by 0x1B4969: Main::starts() (main.cpp:118)
==6314== Block was alloc'd at
==6314== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6314== by 0x6B708D5: ??? (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B71457: _XReply (in /usr/lib/libX11.so.6.3.0)
==6314== by 0xAB5CE77: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0xAB5DAD6: ??? (in /usr/lib/libGLX_nvidia.so.384.90)
==6314== by 0x84F2F2C: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F36BC: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x84F5009: ??? (in /usr/lib/libGLX.so.0.0.0)
==6314== by 0x509F6FC: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091672: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5091856: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x4E75045: sf::Texture::getValidSize(unsigned int) (in /usr/lib/libsfml-graphics.so.2.4.2)
==6314==
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
OpMon: xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
==6314==
==6314== Process terminating with default action of signal 6 (SIGABRT): dumping core
==6314== at 0x5FF28A0: raise (in /usr/lib/libc-2.26.so)
==6314== by 0x5FF3F08: abort (in /usr/lib/libc-2.26.so)
==6314== by 0x5FEB0DB: __assert_fail_base (in /usr/lib/libc-2.26.so)
==6314== by 0x5FEB152: __assert_fail (in /usr/lib/libc-2.26.so)
==6314== by 0x6B70C39: ??? (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B70CEA: ??? (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B70FDC: _XEventsQueued (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x6B4DC1B: XCheckIfEvent (in /usr/lib/libX11.so.6.3.0)
==6314== by 0x509C484: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5096889: ??? (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x5095402: sf::Window::waitEvent(sf::Event&) (in /usr/lib/libsfml-window.so.2.4.2)
==6314== by 0x179126: MainMenu::boucle0() (MainMenu.cpp:88)
==6314==
==6314== HEAP SUMMARY:
==6314== in use at exit: 57,410,327 bytes in 6,402 blocks
==6314== total heap usage: 56,509 allocs, 50,107 frees, 518,286,815 bytes allocated
==6314==
==6314== LEAK SUMMARY:
==6314== definitely lost: 0 bytes in 0 blocks
==6314== indirectly lost: 0 bytes in 0 blocks
==6314== possibly lost: 36,462,808 bytes in 166 blocks
==6314== still reachable: 20,947,519 bytes in 6,236 blocks
==6314== of which reachable via heuristic:
==6314== newarray : 808 bytes in 4 blocks
==6314== multipleinheritance: 104 bytes in 1 blocks
==6314== suppressed: 0 bytes in 0 blocks
==6314== Rerun with --leak-check=full to see details of leaked memory
==6314==
==6314== For counts of detected and suppressed errors, rerun with: -v
==6314== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Je ne sais pas si le problème vient de mon code, de sfml, de mon driver ou de X11. Si il vient de mon code, je suis désolé par avance pour le fait que vous ayez a fouiller dans mon torchon. (Promis j'essaye de l'améliorer).
Si vous avez besoin d'informations que je ne vous ai pas donné, n'hésitez pas a le demander.
Toutes les infos sur ma config :
https://www.driverscloud.com/fr/configuration/49145264-1/resumeMerci d'avance pour votre aide, en espérant que vous pourrez me l'apporter.
-Jlppc