Open danilw opened 2 years ago
Crash happening only on winWidth
change and look like because
float pxRatio = swapChainExtent.width / (float)winWidth;
this line
...
Look like it worst case scenario - problem in font rendering in nanovg source code. Looking on it.
Edit - not worst case it simple malloc out of free space, should be simple to fix .... or no
DPI scale NOT fixed just fixed two mistakes, to not make it crash on normal DPI https://github.com/danilw/nanovg-vulkan-glfw-integration-demo/commit/d1efe736cd7a8b1aa89fd87d3ae67187af069d22 https://github.com/danilw/nanovg-vulkan-glfw-integration-demo/commit/29293954ecf8262b3cb97f2365d98fb5c08a45df
found commit where I did this change https://github.com/danilw/nanovg_vulkan/commit/3e2feb3c8ffe49fb955c8ecd653914835faabd52
but I dont remember why and what for (currently I have broken Vulkan render loop because texture allocation when pixel size not 1 (dpi scale), still looking for correct fix)
Just to track the problem.
Problem: This nanovg-vulkan-glfw-integration-demo crash/segfault on resize. Happening only when C code of nonovg library builded with C++ code. Happening at random - can be first resize or multiple resizes.
Debug: valgrind show no memory leaks, and same as gdb when crash happening it point on:
https://github.com/danilw/nanovg-vulkan-glfw-integration-demo/blob/main/src/nanovg_vk.h#L1457
Not Vulkan or driver bug: Changing
VK_PRESENT_MODE_IMMEDIATE_KHR
toVK_PRESENT_MODE_FIFO_KHR
- crash still happening. ChangingMAX_FRAMES_IN_FLIGHT
to 1 or 10 - crash still happening.But pressing
hotkey 3
(keyboard number 3) or commenting https://github.com/danilw/nanovg-vulkan-glfw-integration-demo/blob/main/example/example_vulkan_glfw_integration.cpp#L1414 to 1435 (removing nanovg render from loop) - no crash.Bug in the C-code of nanovg. And it does look like "double free or corruption" bug - https://youtu.be/xVT1y0xWgww
I checked static variables, and lots of other stuff, still can not see the source of problem... will update when find problem.