New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on resize with 0 height on osx yosemite #984

Closed
caupetit opened this Issue Oct 6, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@caupetit

caupetit commented Oct 6, 2015

Hi.

I got a segfault when resizing window with a heigh of 0 in osx Yosemite 10.10.5 (14F27)

i tried with just the simple window example from the documentation.

here is lldb error:

(lldb) r
Process 44089 launched: './a.out' (x86_64)
Process 44089 stopped
* thread #1: tid = 0x355dc, 0x00007fff94a610c6 CoreGraphics`_CGSShapeSurfaceInline + 36, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5f3fffb0)
    frame #0: 0x00007fff94a610c6 CoreGraphics`_CGSShapeSurfaceInline + 36
CoreGraphics`_CGSShapeSurfaceInline:
->  0x7fff94a610c6 <+36>: movq   %rdi, -0x4040(%rbp)
    0x7fff94a610cd <+43>: movl   %esi, -0x4038(%rbp)
    0x7fff94a610d3 <+49>: movl   %edx, -0x4034(%rbp)
    0x7fff94a610d9 <+55>: movl   %ecx, -0x4030(%rbp)

and begin of backtrace (too long)

    frame #35200: 0x00007fff91430c99 AppKit`-[NSSurface syncToView:] + 237
    frame #35201: 0x00007fff9142a96c AppKit`-[NSView(NSInternal) geometryInWindowDidChange] + 203
    frame #35202: 0x00007fff9142a581 AppKit`-[NSView _invalidateFocus] + 437
    frame #35203: 0x00007fff914bc5a5 AppKit`-[NSWindow _oldPlaceWindow:] + 2263
    frame #35204: 0x00007fff914bb51d AppKit`-[NSWindow _setFrameCommon:display:stashSize:] + 2562
    frame #35205: 0x00007fff917a4d73 AppKit`-[NSWindow(NSWindowResizing) _resizeWithEvent:] + 1469
    frame #35206: 0x00007fff9164a37c AppKit`-[NSTitledFrame mouseDown:] + 200
    frame #35207: 0x00007fff9164a2ab AppKit`-[NSThemeFrame mouseDown:] + 68
    frame #35208: 0x00007fff91bba2dc AppKit`-[NSWindow _reallySendEvent:isDelayedEvent:] + 14125
    frame #35209: 0x00007fff91549c86 AppKit`-[NSWindow sendEvent:] + 470
    frame #35210: 0x00007fff91546212 AppKit`-[NSApplication sendEvent:] + 2504
    frame #35211: 0x0000000100091bbc libsfml-window.2.3.dylib`-[SFApplication sendEvent:] + 140
    frame #35212: 0x0000000100091433 libsfml-window.2.3.dylib`+[SFApplication processEvent] + 99
    frame #35213: 0x0000000100097e48 libsfml-window.2.3.dylib`sf::priv::WindowImplCocoa::processEvents() + 24
    frame #35214: 0x000000010008bbd3 libsfml-window.2.3.dylib`sf::priv::WindowImpl::popEvent(sf::Event&, bool) + 51
    frame #35215: 0x000000010008af06 libsfml-window.2.3.dylib`sf::Window::pollEvent(sf::Event&) + 38
    frame #35216: 0x0000000100000ac2 a.out`main + 290
    frame #35217: 0x00007fff8c9205c9 libdyld.dylib`start + 1
    frame #35218: 0x00007fff8c9205c9 libdyld.dylib`start + 1

Hope it can help.

@eXpl0it3r

This comment has been minimized.

Show comment
Hide comment
@eXpl0it3r

eXpl0it3r Oct 7, 2015

Member

Next time you should really follow the Contribution Guidelines.

@mantognini ? 😉

Member

eXpl0it3r commented Oct 7, 2015

Next time you should really follow the Contribution Guidelines.

@mantognini ? 😉

@mantognini

This comment has been minimized.

Show comment
Hide comment
@mantognini

mantognini Oct 7, 2015

Member

Ho, seems like I missed this one. Will have a look over the weekend if precise step by step instructions to reproduce the bug are available.

Member

mantognini commented Oct 7, 2015

Ho, seems like I missed this one. Will have a look over the weekend if precise step by step instructions to reproduce the bug are available.

@caupetit

This comment has been minimized.

Show comment
Hide comment
@caupetit

caupetit Oct 8, 2015

Hi. Sorry thought it was enough, I've tried it with the last version on master branch.

Here is the test code:

#include <SFML/Window.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");

    // 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
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

Just resize the window to a height of 0 (no need to release mouse button will segv before).

Please tell me if you need more informations and hope it is not a copy i didn't found it anywhere. (forum/issues)

caupetit commented Oct 8, 2015

Hi. Sorry thought it was enough, I've tried it with the last version on master branch.

Here is the test code:

#include <SFML/Window.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");

    // 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
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

Just resize the window to a height of 0 (no need to release mouse button will segv before).

Please tell me if you need more informations and hope it is not a copy i didn't found it anywhere. (forum/issues)

@mantognini mantognini removed the s:undecided label Oct 10, 2015

@mantognini mantognini self-assigned this Oct 10, 2015

@mantognini

This comment has been minimized.

Show comment
Hide comment
@mantognini

mantognini Oct 10, 2015

Member

Ok, after quick investigation, this is a bug in OS X: an infinite recursion happens when resizing the OpenGL view. Here's how Chromium fixed it.

It was actually also mentioned once on the forum.

Here a partial stack trace of the issue:

#0  0x00007fff8d5c30c6 in _CGSShapeSurfaceInline ()
#1  0x00007fff8d5c3095 in CGSSetSurfaceShape ()
#2  0x00007fff84ad3708 in -[NSSurface setFrame:] ()
#3  0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#4  0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#5  0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#6  0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#7  0x00007fff8e3d0634 in _CFXNotificationPost ()
#8  0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#9  0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#10 0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#11 0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#12 0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#13 0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#14 0x00007fff8e3d0634 in _CFXNotificationPost ()
#15 0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#16 0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#17 0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#18 0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#19 0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#20 0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#21 0x00007fff8e3d0634 in _CFXNotificationPost ()
#22 0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()

<snip>

#35142  0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#35143  0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#35144  0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#35145  0x00007fff84ad096c in -[NSView(NSInternal) geometryInWindowDidChange] ()
#35146  0x00007fff84ad0581 in -[NSView _invalidateFocus] ()
#35147  0x00007fff84b625a5 in -[NSWindow _oldPlaceWindow:] ()
#35148  0x00007fff84b6151d in -[NSWindow _setFrameCommon:display:stashSize:] ()
#35149  0x00007fff84e4ad73 in -[NSWindow(NSWindowResizing) _resizeWithEvent:] ()
#35150  0x00007fff84cf037c in -[NSTitledFrame mouseDown:] ()
#35151  0x00007fff84cf02ab in -[NSThemeFrame mouseDown:] ()
#35152  0x00007fff852602dc in -[NSWindow _reallySendEvent:isDelayedEvent:] ()
#35153  0x00007fff84befc86 in -[NSWindow sendEvent:] ()
#35154  0x00007fff84bec212 in -[NSApplication sendEvent:] ()
#35155  0x0000000100089696 in -[SFApplication sendEvent:] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFApplication.m:259
#35156  0x0000000100088ad2 in +[SFApplication processEvent] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFApplication.m:47
#35157  0x0000000100091c6f in -[SFWindowController processEvent] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFWindowController.mm:544
#35158  0x0000000100095023 in sf::priv::WindowImplCocoa::processEvents() at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/WindowImplCocoa.mm:467
#35159  0x0000000100075bd1 in sf::priv::WindowImpl::popEvent(sf::Event&, bool) at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/WindowImpl.cpp:120
#35160  0x0000000100074b39 in sf::Window::pollEvent(sf::Event&) at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/Window.cpp:187
#35161  0x0000000100006e46 in main at /Users/m/Prog/Tests/SFML/Test Events/Test Events/main.cpp:311
#35162  0x00000001000015b4 in start ()
Member

mantognini commented Oct 10, 2015

Ok, after quick investigation, this is a bug in OS X: an infinite recursion happens when resizing the OpenGL view. Here's how Chromium fixed it.

It was actually also mentioned once on the forum.

Here a partial stack trace of the issue:

#0  0x00007fff8d5c30c6 in _CGSShapeSurfaceInline ()
#1  0x00007fff8d5c3095 in CGSSetSurfaceShape ()
#2  0x00007fff84ad3708 in -[NSSurface setFrame:] ()
#3  0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#4  0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#5  0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#6  0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#7  0x00007fff8e3d0634 in _CFXNotificationPost ()
#8  0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#9  0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#10 0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#11 0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#12 0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#13 0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#14 0x00007fff8e3d0634 in _CFXNotificationPost ()
#15 0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#16 0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#17 0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#18 0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#19 0x00007fff84dc2629 in -[NSOpenGLContext update] ()
#20 0x00007fff8e4e045c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
#21 0x00007fff8e3d0634 in _CFXNotificationPost ()
#22 0x00007fff8f3ffaa1 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()

<snip>

#35142  0x00007fff84ad37e1 in -[NSSurface setFrame:] ()
#35143  0x00007fff84ad2e70 in -[NSSurface syncToViewUnconditionally] ()
#35144  0x00007fff84ad6c99 in -[NSSurface syncToView:] ()
#35145  0x00007fff84ad096c in -[NSView(NSInternal) geometryInWindowDidChange] ()
#35146  0x00007fff84ad0581 in -[NSView _invalidateFocus] ()
#35147  0x00007fff84b625a5 in -[NSWindow _oldPlaceWindow:] ()
#35148  0x00007fff84b6151d in -[NSWindow _setFrameCommon:display:stashSize:] ()
#35149  0x00007fff84e4ad73 in -[NSWindow(NSWindowResizing) _resizeWithEvent:] ()
#35150  0x00007fff84cf037c in -[NSTitledFrame mouseDown:] ()
#35151  0x00007fff84cf02ab in -[NSThemeFrame mouseDown:] ()
#35152  0x00007fff852602dc in -[NSWindow _reallySendEvent:isDelayedEvent:] ()
#35153  0x00007fff84befc86 in -[NSWindow sendEvent:] ()
#35154  0x00007fff84bec212 in -[NSApplication sendEvent:] ()
#35155  0x0000000100089696 in -[SFApplication sendEvent:] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFApplication.m:259
#35156  0x0000000100088ad2 in +[SFApplication processEvent] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFApplication.m:47
#35157  0x0000000100091c6f in -[SFWindowController processEvent] at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/SFWindowController.mm:544
#35158  0x0000000100095023 in sf::priv::WindowImplCocoa::processEvents() at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/OSX/WindowImplCocoa.mm:467
#35159  0x0000000100075bd1 in sf::priv::WindowImpl::popEvent(sf::Event&, bool) at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/WindowImpl.cpp:120
#35160  0x0000000100074b39 in sf::Window::pollEvent(sf::Event&) at /Users/m/Prog/Projects/SFML/git/SFML/src/SFML/Window/Window.cpp:187
#35161  0x0000000100006e46 in main at /Users/m/Prog/Tests/SFML/Test Events/Test Events/main.cpp:311
#35162  0x00000001000015b4 in start ()
@mantognini

This comment has been minimized.

Show comment
Hide comment
@mantognini

mantognini Oct 10, 2015

Member

Superseded by #986.

Member

mantognini commented Oct 10, 2015

Superseded by #986.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment