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

Author Topic: [SFML 2] Closing application via console  (Read 1932 times)

0 Members and 3 Guests are viewing this topic.

ison

  • Newbie
  • *
  • Posts: 13
    • View Profile
[SFML 2] Closing application via console
« on: August 25, 2012, 06:33:24 pm »
Hello,
I've recently noticed that when I close my application via console close button, SIGSEGV is raised. Minimal program which reproduces this bug would be
int main()
{
    window.create(sf::VideoMode(1024, 768), "window", sf::Style::Default);
    sf::Text test;
    test.setCharacterSize(11);
    test.setString(" ");
    while(1);
}
 
When program reaches while(1) try to close it with console close button.
Problem occures only with sf::Text afaik. If you comment this line test.setString(" "); it doesn't happen.
Is it suppoused to be like this? I know that closing application via console close button isn't completely normal way to terminate application but it still shouldn't happen I think.
« Last Edit: August 25, 2012, 07:52:58 pm by Laurent »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [SFML 2] Closing application via console
« Reply #1 on: August 25, 2012, 06:46:42 pm »
Quote
Is it suppoused to be like this?
I don't know what should happen when you close the console like this AND have an infinite loop that does nothing at all.

What happen without the loop ?
SFML / OS X developer

ison

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: [SFML 2] Closing application via console
« Reply #2 on: August 25, 2012, 07:52:22 pm »
What happen without the loop ?
It doesn't matter what application is doing at the moment, I just did it to easily reproduce it so you have time to press console exit button.
If program exits normally SIGSEGV isn't raised.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [SFML 2] Closing application via console
« Reply #3 on: August 25, 2012, 07:54:01 pm »
Closing the console is not a clean way to end a program. Closing a program by an external source is never clean, only controlled termination within the program itself is clean.
Laurent Gomila - SFML developer