pthom / imgui_bundle

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!
https://pthom.github.io/imgui_bundle/
MIT License
592 stars 63 forks source link

MSVC debug assertion failed due to the imgui_demo.cpp `isspace` call. #145

Closed vertexi closed 7 months ago

vertexi commented 7 months ago

When dynamically initializing the DemoCodeWindow GDemoCodeWindow; variable, the isspace function inside the CodeLineStartsWith() be called. Because of the initial value at haystack is negative, the c >= -1 && c <= 255 Debug assertion failed inside isspace().

https://github.com/pthom/imgui/blame/812f25683087ec5ca6c0802da6e40f682459ae25/imgui_demo.cpp#L8945

Maybe initialize the char line_buffer[2048]; to zeros?

pthom commented 7 months ago

Hum, it seems like you spotted a segfault here! I see that you forked the repo. Would you like to post a related PR?

Many thanks!

pthom commented 7 months ago

I will prepare a fix quickly, please tell me if it solves the issue.

pthom commented 7 months ago

(the fix is not that easy, because the code is in a fork of ImGui that I maintain)

pthom commented 7 months ago

It should be ok now, please let me know if it is ok on your side

vertexi commented 7 months ago

Looks good. Nice job! Thank you.