AdamYuan / MyVK

4 stars 0 forks source link

Segmentation fault - ImGuiInfo #1

Closed Aidan-Sanders closed 2 days ago

Aidan-Sanders commented 1 week ago

Hey Adam, hope your doing well, on application exit resources in ImGuiInfo cause a segmentation fault. ImGuiInfo getting freed after MyVK is freed?

struct ImGuiInfo {
    Ptr<Image> font_texture;
    Ptr<ImageView> font_texture_view;
    Ptr<Sampler> font_texture_sampler;
};
AdamYuan commented 1 week ago

Hi Aiden, I'm currently busy with the internship sadly.

I think this might be the problem of global std::shared_ptr variables in ImGuiInfo preventing some resource to be freed. And adding a line myvk::kImGuiInfo = {}; at the end of main() might help.

I've never encountered the crash before, and I'm not sure whether it's my problem or the compiler's. If possible, could you provide some detailed debug information such as the call stack?

Aidan-Sanders commented 1 week ago

Hope this helps, ended up building a new computer for VkHashDAG. I don't think i had a issue with the segmentation fault before so it could be driver. Currently my workaround is just calling ImGuiRelease before application exit.

inline void ImGuiRelease()
{
  kImGuiInfo.font_texture.reset();
  kImGuiInfo.font_texture_view.reset();
  kImGuiInfo.font_texture_sampler.reset();
}

gdb_output.log

address_sanitizer.log

If you need anything else just ask :D

AdamYuan commented 2 days ago

Thank you for the detailed information. Probably it's a driver problem, otherwise I can't think of a way that std::shared_ptr without any circular reference could cause a crash at destruction.