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

Author Topic: SFML Windows OS controls causing random freezing  (Read 3992 times)

0 Members and 1 Guest are viewing this topic.

zacaj

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
SFML Windows OS controls causing random freezing
« on: November 12, 2013, 09:46:08 pm »
Windows 8 x64, Visual Studio 2013, Release and Debug build, using static SFML lib.

Usually immediately when I start the program, but sometimes not until after a few clicks, the window will freeze for 7-12 seconds.

This usually happens which I drag the window around, hover over an edge so the resize cursor appears, or hover over any of the window buttons.

int _tmain(int argc, _TCHAR* argv[])
{
        sf::RenderWindow *window=new sf::RenderWindow(sf::VideoMode(800, 600), "title");

        window->setFramerateLimit(60);
        // run the program as long as the window is open
        while (window->isOpen())
        {
                // check all the window's events that were triggered since the last iteration of the loop
                printf("start");
                sf::Event event;
                while (window->pollEvent(event))
                {
                        // "close requested" event: we close the window
                        if (event.type == sf::Event::Closed)
                                window->close();
                        printf("event!");
                }
                printf("clear");
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                {
                        window->close();
                }
                window->clear();
                printf("display");
                window->display();
                printf("done");
        }
        delete window;
        return 0;
}
 

the freeze happens somewhere between the "start" and the "event!" but also sometimes between "display" and "done"
« Last Edit: November 12, 2013, 10:03:32 pm by zacaj »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11037
    • View Profile
    • development blog
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #1 on: November 13, 2013, 01:55:41 pm »
Are you running any intrusive anti-virus software? You could start a profiler to see where the time is wasted.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zacaj

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #2 on: November 13, 2013, 02:21:32 pm »
The only antivirus I have would be Windows Defender that comes with Windows 8.  Watching Task Manager does not show any spike in CPU usage during in the freeze, and profiling simply reports much time spent in sfml-window-d-2.dll

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11037
    • View Profile
    • development blog
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #3 on: November 13, 2013, 02:32:37 pm »
Do you have any joystick connect to your PC?

Add the debug info next to the dll and make sure the profiler finds the source of SFML, that way you should be able to see on what it hangs around.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zacaj

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #4 on: November 13, 2013, 10:56:48 pm »
It's hanging in popEvent() and inside of that processEvents() and processJoystickEvents().  It seems like this is the same problem as described in this thread: https://web.archive.org/web/20111212214226/http://sfml-dev.org/forum/viewtopic.php?t=6079, from 2011.  Is this still not fixed?

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML Windows OS controls causing random freezing
« Reply #5 on: November 13, 2013, 11:05:16 pm »
Hmm the problems discribed in that thread have been fixed as far as I know. What version of SFML are you using?

zacaj

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #6 on: November 13, 2013, 11:08:20 pm »
2.1, downloaded straight off the site two days ago. 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11037
    • View Profile
    • development blog
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #7 on: November 14, 2013, 12:40:24 am »
Seems like my guess was right, but I have to ask again: Do you have any joystick or controller connected to your PC?

Maybe one could find out why it hangs there based on the controller.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zacaj

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: SFML Windows OS controls causing random freezing
« Reply #8 on: November 14, 2013, 12:41:12 am »
No joysticks, just mouse, keyboard, and HDDs