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

Author Topic: Bug Report window not responding  (Read 3735 times)

0 Members and 1 Guest are viewing this topic.

nwp

  • Newbie
  • *
  • Posts: 4
    • View Profile
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.

#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.
« Last Edit: December 20, 2015, 11:22:45 am by nwp »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Bug Report window not responding
« Reply #1 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

HeapOfCode

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Bug Report window not responding
« Reply #2 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


zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Bug Report window not responding
« Reply #3 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).
« Last Edit: December 21, 2015, 05:33:52 am by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything