1
Window / Bug Report window not responding
« 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.
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.
#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
}
}
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.