Skip to content
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

Multi Viewport: segfault when collapsing window #8132

Open
gucio321 opened this issue Nov 6, 2024 · 4 comments
Open

Multi Viewport: segfault when collapsing window #8132

gucio321 opened this issue Nov 6, 2024 · 4 comments

Comments

@gucio321
Copy link

gucio321 commented Nov 6, 2024

Version/Branch of Dear ImGui:

Version c347d69, Branch: docking

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp (also happens for glfw 3.3)

Compiler, OS:

Arch Linux + g++ (GCC) 14.2.1 20240910

Full config/build information:

Dear ImGui 1.91.5 WIP (19141)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201103
define: __linux__
define: __GNUC__=14
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl2
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000483
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My Issue/Question:

While working on cimgui-go I noticed that double-clicking window titlebar, when it is 'detached' from the main viewport crashes an app with segfault.

Segmentation fault (core dumped)
(gdb) bt
#0  0x00007ffff655914d in ?? () from /usr/lib/libGLX_nvidia.so.0
#1  0x00007ffff4cb3c13 in ?? () from /usr/lib/libnvidia-glcore.so.565.57.01
#2  0x00007ffff657a15e in ?? () from /usr/lib/libGLX_nvidia.so.0
#3  0x00007ffff6548490 in ?? () from /usr/lib/libGLX_nvidia.so.0
#4  0x00007ffff7e2be6a in X11_GL_SwapWindow (_this=<optimized out>, window=<optimized out>)
    at /usr/src/debug/sdl2/SDL2-2.30.9/src/video/x11/SDL_x11opengl.c:1010
#5  0x0000555555669fe8 in ImGui_ImplSDL2_SwapBuffers (viewport=0x5555557631a0) at ../../backends/imgui_impl_sdl2.cpp:1142
#6  0x00005555555948d7 in ImGui::RenderPlatformWindowsDefault (platform_render_arg=0x0, renderer_render_arg=0x0) at ../../imgui.cpp:16478
#7  0x0000555555559f1a in main () at main.cpp:218

Screenshots/Video:

Screencast.From.2024-11-06.10-42-38.mp4

Minimal, Complete and Verifiable Example code:

examples/example_sdl2_opengl3

@AMRD1234
Copy link

AMRD1234 commented Nov 7, 2024

i have the same issue with imgui docking...
on windows docking is working well but i dont know why this is so buggy in linux (im using ubuntu).
when i put the imgui demo window or any window outside of GLFW MAIN Window it getts too buggy....
ocornut does this issue solvable???

@ocornut
Copy link
Owner

ocornut commented Nov 7, 2024

@gucio321 You would likely need to investigate this further on your end.

Some thoughts:

  • I cannot understand how collapsing would make a difference from the point of view of rendering. It's just a smaller window. It would call SDL_SetWindowSize() first (and GLFW equivalent), and immediately attempt to render and swap.

Some pointers:

  • Try updating/toying with your OpenGL drivers and setups. They are known to be a mess.
  • Try to confirm first that it happens with unmodified examples app.
  • Try with the equivalent SDL3 example.
  • Try to comment out all or some of the code in ImGui_ImplOpenGL3_RenderWindow() and see if it makes a difference. AKA see if simply calling the SDL sides of things, aka SDL_SetWindowSize() then ImGui_ImplSDL2_SwapBuffers() makes a difference.
  • Just in case, try testing for the return value of the SDL_GL_MakeCurrent() calls in ImGui_ImplSDL2_RenderWindow() and ImGui_ImplSDL2_SwapBuffers(). You can use IM_ASSERT(ret_value == 0);.

For all those attempts, please be explicit what you have you tried and the results. Details would be useful.

@gucio321
Copy link
Author

gucio321 commented Nov 7, 2024

Try updating/toying with your OpenGL drivers and setups. They are known to be a mess.

I use arch btw 😄

Try to confirm first that it happens with unmodified examples app.

Yes, I'm on latest docking release (not modified)

Try with the equivalent SDL3 example.

same.

I cannot understand how collapsing would make a difference from the point of view of rendering. It's just a smaller window. It would call SDL_SetWindowSize() first (and GLFW equivalent), and immediately attempt to render and swap.

I've just tested for a while and dtected an interesting behavior: The easiest way to reproduce this crash is collapsing but also, fast resizing the window causes that (If I do that slowly, it doesn't happen 😄).

I'll test to play a little bit more later

@gucio321
Copy link
Author

gucio321 commented Nov 7, 2024

@ocornut I did another test: I boted up my fedora and tested there.
On Gnome it crashes just like on my arch.
But when I choose gnome on Xorg, it works fine.
I think that since SDL/GLFW does not support Multi Viewport on wayland, it automatically defaults to Xorg so XWayland. And this is a problem for some reason...

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

No branches or pull requests

3 participants