SFML community forums

Help => General => Topic started by: ison on August 25, 2012, 06:33:24 pm

Title: [SFML 2] Closing application via console
Post by: ison 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.
Title: Re: [SFML 2] Closing application via console
Post by: Hiura 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 ?
Title: Re: [SFML 2] Closing application via console
Post by: ison 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.
Title: Re: [SFML 2] Closing application via console
Post by: Laurent 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.