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

example_glfw_opengl3 viewports crashed with NULL vd->Window #5687

Closed
sweihub opened this issue Sep 16, 2022 · 5 comments
Closed

example_glfw_opengl3 viewports crashed with NULL vd->Window #5687

sweihub opened this issue Sep 16, 2022 · 5 comments

Comments

@sweihub
Copy link

sweihub commented Sep 16, 2022

Dear Imgui

Refer to #1542
I'm playing with the magical Viewports, but it crashed with a NULL window pointer, see the screenshots.

Reproduce

  1. Clone the code from https://github.com/sweihub/photon
  2. Open and build the project on Windows with VS2017, otherwise, you may need to retarget projects
  3. Remove imgui.ini if any, debug and run
  4. Click Demo Candlestick
  5. Drag the window Demo Candlestick out of the main window, in order to activate viewports
  6. Resize the Demo Candlestick
  7. Crashed with NULL pointer

image

image

@ocornut
Copy link
Owner

ocornut commented Sep 16, 2022

Hello,
I cannot seem to repro.

  • What are the values passed to the failing glfwCreateWindow() call ?
  • Resizing a window shouldn't call the _CreateWindow in the backend so your repro seems to be missing something.

@sweihub
Copy link
Author

sweihub commented Sep 19, 2022

Hi @ocornut

I updated the GLFW to v3.8, and corresponding library to lib-vs2017, the problem remains the same, I can reproduce it on my Windows 11, but it works on my Macbook. I will try to debug, but I am not familiar with GLFW.

Please check the screenshots, the ImGui_ImplGlfw_CreateWindow was called but immediately crashed with vd->Windows NULLpointer.

image

The Call Stack
image

void ImGui::UpdatePlatformWindows()
image

@sweihub
Copy link
Author

sweihub commented Sep 20, 2022

Hi @ocornut

The code is complete, I did not missing anything, GLFW error message for your reference

static void glfw_error_callback(int error, const char* description)
{
	fpintf(stderr, "Glfw Error %d: %s\n", error, description);
}

Output
Glfw Error 65543: WGL: Failed to create OpenGL context

Shoud it be video card driver issue?

@sweihub
Copy link
Author

sweihub commented Sep 20, 2022

Hi @ocornut

I tested example_win32_directx11 on my Windows 11, which solved the issue, apparently either driver or GLFW is buggy on Windows. So I have to go with direct11 for Windows, GLFW for mac.

I wil close the issue, the thread hopefully will solve the same issue for potentianl users.

@sweihub sweihub closed this as completed Sep 20, 2022
@mwindowshz
Copy link

mwindowshz commented Sep 22, 2022

I have also this problem on different line
file: imgui_impl_glfw.cpp
function: ImGui_ImplGlfw_CreateWindow

glfwCreateWindow fails
Glfw Error 65546: The specified window has no context.7822

Also when I drag the window out side of the main window. sometimes even inside the window.
image

This happends with OpenGL on windows 10
If I use Vulkan it is stable.

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