SFML community forums

Help => Window => Topic started by: nwp on December 19, 2015, 11:39:18 pm

Title: Bug Report window not responding
Post by: nwp on December 19, 2015, 11:39:18 pm
The following code compiles, links and runs correctly, but after ~5 seconds I get a kill popup that window "Test" is not responding and if I want to kill it. I understand that the window manager sends events to my window and if I do not get them the window manager assumes my program is stuck. However, as you can see in the code, I don't leave the message queue unattended for more than 100ms so I should not get a kill popup.

#include <SFML/Graphics.hpp>

void do_useful_stuff(){
        //changed this_thread::sleep_for to sf::sleep, thanks to Hapax
        sf::sleep(sf::milliseconds(100)); //pretend this does something useful
}

int main(){
        //initialize window
        sf::RenderWindow window(sf::VideoMode(800, 600), "Test");

        //optional workaround
        if (false){ //set to true to enable workaround
                sf::Event event;
                window.pollEvent(event);
        }

        //initialize stuff that needs the RenderWindow
        do_useful_stuff();

        //enter event loop
        sf::Event event;
        while (window.isOpen()){
                while (window.pollEvent(event)){
                        if (event.type == sf::Event::Closed){
                                window.close();
                        }
                }
                window.clear(sf::Color::Black);
                window.display();
                do_useful_stuff(); //other logic stuff
        }
}

The code has an optional workaround, which is polling an event right after creating the window which prevents the kill popup.  This may be a bug in my window manager and not in SFML, so it would be good if someone could try it on another platform.

Platform details:
* Up to date Debian testing
* SFML 2.3.2+dfsg-1
* Gnome 1:3.14+3

A friend has the same issue on Debian Sid, but it takes 10 seconds for the window manager to complain.

Maybe someone has KDE and could try it? Then we can figure out if it is likely to be a problem with the X-server or Gnome.
Title: Re: Bug Report window not responding
Post by: Hapax on December 20, 2015, 02:05:07 am
Tested your code and it seemed to work without any problems for me.
Not sure why you needed to include thread just to sleep when sf::sleep(sf::milliseconds(100)); would've done the job just fine  ;)

SFML v2.3.2, 32-bit
Windows 7
Visual Studio 2013
debug, release, debug static and release static all tested.
Title: Re: Bug Report window not responding
Post by: HeapOfCode on December 20, 2015, 07:23:21 pm
Seems to work for me too.

sfml 2.3.2
gcc 5.3.0-2
4.2.5-1-ARCH, AwesomeWM

Title: Re: Bug Report window not responding
Post by: zsbzsb on December 21, 2015, 05:30:52 am
https://github.com/SFML/SFML/pull/947

Make sure you are using SFML 2.3.2 or the latest master (which you should use for bug testing).