Content-Length: 286831 | pFad | http://github.com/zig-gamedev/zig-gamedev/issues/618

F3 triangle_wgpu imgui demo segfault on exit · Issue #618 · zig-gamedev/zig-gamedev · GitHub
Skip to content

triangle_wgpu imgui demo segfault on exit #618

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

Open
AndrewKraevskii opened this issue Jun 4, 2024 · 6 comments
Open

triangle_wgpu imgui demo segfault on exit #618

AndrewKraevskii opened this issue Jun 4, 2024 · 6 comments
Milestone

Comments

@AndrewKraevskii
Copy link

Steps to reproduce:

  1. zig build triangle_wgpu-run
  2. Open imgui demo -> Examples -> Miniapps -> Console
  3. Close with esc or with X window button.

image

@hazeycode hazeycode added the bug Something isn't working label Jun 5, 2024
@Pyrolistical
Copy link
Contributor

I think the bug is the destructor is never called upon this static:

static ExampleAppConsole console;

@Pyrolistical
Copy link
Contributor

Pyrolistical commented Jun 12, 2024

The destructor is called if console is made global:

diff --git a/libs/zgui/libs/imgui/imgui_demo.cpp b/libs/zgui/libs/imgui/imgui_demo.cpp
index 9b4ba871..ca67882d 100644
--- a/libs/zgui/libs/imgui/imgui_demo.cpp
+++ b/libs/zgui/libs/imgui/imgui_demo.cpp
@@ -7425,9 +7425,9 @@ struct ExampleAppConsole
     }
 };

+static ExampleAppConsole console;
 static void ShowExampleAppConsole(bool* p_open)
 {
-    static ExampleAppConsole console;
     console.Draw("Example: Console", p_open);
 }

I think clang is incorrectly removing the destructor thinking that is an unobservable change.

@Pyrolistical
Copy link
Contributor

Ah, is the problem there is an attempt to call the destructor but the allocator is already been deinit?

Seems similar to ocornut/imgui#538

@hazeycode hazeycode added this to the 0.7.0 milestone Jun 15, 2024
@hazeycode
Copy link
Member

The destructor is called if console is made global:

This looks like the fix to me.

@Pyrolistical
Copy link
Contributor

Pyrolistical commented Jun 15, 2024

This looks like the fix to me.

If so can we repo this without zig-gamedev and fix it upstream?

@Pyrolistical
Copy link
Contributor

I think we should consider this "not an issue" since it is a deliberate choice as per ocornut/imgui#538 (comment)

We can "fix" this issue by removing the imgui demo window from triangle_wgpu

@hazeycode hazeycode added the demo label Nov 2, 2024
@hazeycode hazeycode removed bug Something isn't working demo labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/zig-gamedev/zig-gamedev/issues/618

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy