SFML community forums

Help => Window => Topic started by: j.keller51 on February 04, 2020, 05:15:49 pm

Title: Legacy MacOS OpenGL Freeze
Post by: j.keller51 on February 04, 2020, 05:15:49 pm
Hi,

I've been working on an app that I want to be available for older MacOS versions. On MacOS 10.10, this very simple code causes the window to totally freeze up (MacOS shows the spinner icon) when the mouse hovers over it. As soon as the mouse leaves the window, it resumes rendering.

int main() {
    sf::RenderWindow window(sf::VideoMode(800,600), "Test Window");
   
    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }
       
        window.clear(sf::Color::Black);
       
        sf::CircleShape circ(50);
        circ.setOutlineColor(sf::Color::Red);
        circ.setOutlineThickness(10);
        circ.setFillColor(sf::Color::Blue);
        circ.setPosition(50, 50);
        window.draw(circ);
       
        window.display();
       
       
    }
    return 0;
}

Here is the MacOS spin report:

Quote
Date/Time:       2020-02-04 07:48:19 -0800
OS Version:      10.10.5 (Build 14F27)
Architecture:    x86_64
Report Version:  21

Command:         Zivix Graphics Playground
Path:            /Users/USER/Downloads/ZivixGraphicsPlayground-30.app/Contents/MacOS/ZivixGraphicsPlayground
Version:         ??? ()
PID:             908

Event:           timeout-lite
Duration:        10.00s (process was unresponsive for 2 seconds before sampling)
Steps:           101 (100ms sampling interval)

Hardware model:  MacBookPro11,3
Active cpus:     4


Heaviest stack for the main thread of the target process:
  101  start + 1 (libdyld.dylib + 13769) [0x7fff930fc5c9]
  101  main + 685 (ZivixGraphicsPlayground + 19197) [0x100114afd]
  101  sf::Window::display() + 60 (ZivixGraphicsPlayground + 626988) [0x1001a912c]
  101  sf::priv::SFContext::display() + 33 (ZivixGraphicsPlayground + 555041) [0x100197821]
  101  -[NSOpenGLContext flushBuffer] + 27 (AppKit + 3354155) [0x7fff99a52e2b]
  101  CGLFlushDrawable + 66 (OpenGL + 53178) [0x7fff921fefba]
  101  glSwap_Exec + 97 (GLEngine + 119089) [0x7fff98c3d131]
  101  glsFlushDrawBufferIsBackingStore + 307 (GLRendererFloat + 76058) [0x7fff9819e91a]
  101  CGSLockWindowBits + 34 (CoreGraphics + 1337281) [0x7fff8ec237c1]
  101  CGSLockWindowRectBits + 72 (CoreGraphics + 1336943) [0x7fff8ec2366f]
  101  lock_window_backing + 910 (CoreGraphics + 279119) [0x7fff8eb2124f]
  101  CGSWindowSynchronizeBacking + 40 (CoreGraphics + 279926) [0x7fff8eb21576]
  101  _CGSSynchronizeWindowBackingStore + 110 (CoreGraphics + 536520) [0x7fff8eb5ffc8]
  101  mach_msg_trap + 10 (libsystem_kernel.dylib + 70878) [0x7fff8d41d4de]
 *101  ipc_mqueue_receive_continue + 0 (kernel + 1144832) [0xffffff8000317800]

It seems to have something to do with NSOpenGLContext::flushBuffer, though my googling didn't turn up anything very helpful.

Any suggestions are much appreciated!

Thanks,
Jon