Save File Dialog in UE4 results in crashes

Hi all,

So I’ve recently been trying to implement a windows SaveFileDialog to a UE4 project. Using khalibloo’s implementation in this post, I managed to get it fully working. Now although it works as it should, it sometimes randomly crashes at a break point in MallocTBB.cpp (67):

67: NewPtr = scalable_malloc( Size );

Exception thrown: read access violation.
    temp was 0x6900760061.

Here is my callstack , which seems to only involve some engine functions. My output log also gets cluttered with some windows related messages (“Le lecteur spécifié est introuvable” = Drive can’t be found).

I’ve managed to pinpoint it down to the way I’m setting the ofn->FileName variable in the FileDialog class (cpp, header). This is how I’m creating the dialog from a BP Library, here. If I comment out the FileName line everything works fine with no crashes (still the cluttered output log tho).

Does anyone have an idea on how to fix that? I spent the past few days trying to play around with it but I can’t get my head around it.