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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Hurlu

Pages: [1]
1
Hi !

I'm currently trying out the SFML, and found out this strange undefined behaviour while trying to make a first test program.
It may or may not be a valid bug report, in which case, i'll be glad for you to enligthen me with why is this short code snippet crashing !

Here is the responsible code :

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

void event_conditions(sf::RenderWindow *window)
{
  sf::Event event;
  // sf::Texture text; /* Declaring it here works fine */

  while (window->pollEvent(event))
    {
      if (event.type == sf::Event::Closed ||
          (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)))
        window->close();
      window->display();
    }
}

int main ()
{
  sf::RenderWindow window(sf::VideoMode(900, 600), "Test_sfml");
  sf::Texture text; // If I remove this line, the Event.poll does not Segfault anymore.
 
  window.clear(sf::Color::Black);
  while (window.isOpen())
    {
      event_conditions(&window);
    }
  return 0;
}
 

Here is the linked valgrind output :
==25892== Invalid read of size 8
==25892==    at 0x5095DE6: sf::Window::filterEvent(sf::Event const&) (in /usr/lib/libsfml-window.so.2.4.1)
==25892==    by 0x400D94: event_conditions(sf::RenderWindow*) (main.cpp:9)
==25892==    by 0x400EDB: main (main.cpp:26)
==25892==  Address 0x19 is not stack'd, malloc'd or (recently) free'd
==25892==
==25892==
==25892== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==25892==  Access not within mapped region at address 0x19
==25892==    at 0x5095DE6: sf::Window::filterEvent(sf::Event const&) (in /usr/lib/libsfml-window.so.2.4.1)
==25892==    by 0x400D94: event_conditions(sf::RenderWindow*) (main.cpp:9)
==25892==    by 0x400EDB: main (main.cpp:26)
 

Version of SFML is 2.4.1, running on ArchLinux, recompiled multiple times with no more luck :(

Thanks for your time !

Pages: [1]
anything