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

Author Topic: [SOLVED] Runtime error after Closing the App with an Event  (Read 3758 times)

0 Members and 1 Guest are viewing this topic.

WorldRacer

  • Newbie
  • *
  • Posts: 16
    • View Profile
Hey,

I have the following Problem:
I created a console Application. When I close the console, the App exits normally. But if I close the App with Events (sf::Event::Closed or (Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape) ) , then I get a runtime error...

Unbehandelte Ausnahme bei 0x69764ec0 in SkipBoD.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x01420654.

^^thats the german one...wait...I'll translate it:

Unhandled Exception at 0x69764ec0 in SkipBoD.exe: 0x0000005: Access violation while reading at position 0x01420654.

Anybody knows how to fix this?

Code: [Select]

while (App.IsOpened())
{


// Clear screen
App.Clear(sf::Color(255,255,255));

App.Draw(sprSfml_logo);
// Draw the string
            App.Draw(Text);

App.Display();
sf::Event Event;
while (App.GetEvent(Event))
{
// Window closed
if (Event.Type == sf::Event::Closed)
App.Close();

       // Escape key pressed
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)){
App.Close();
}
}
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Runtime error after Closing the App with an Event
« Reply #1 on: May 22, 2009, 11:34:08 am »
This is probably the know bug about sf::String. There are many topics about it on this forum ;)
Laurent Gomila - SFML developer

WorldRacer

  • Newbie
  • *
  • Posts: 16
    • View Profile
[SOLVED] Runtime error after Closing the App with an Event
« Reply #2 on: May 22, 2009, 11:42:43 am »
Yeah, its the string! Because if I remove the lines of the string, it works properly!

Is there a way round it?
EDIT: http://www.sfml-dev.org/forum/viewtopic.php?t=956&postdays=0&postorder=asc&highlight=string+bug&start=15 Here is the solution ;)

But theres an Error with the Default charset...how do I declare it?

EDIT: Solution - Define SFML_DYNAMIC in Preprocessor defines. Then it works!