Access Violation in C++ class

Your quastion is too general… so i will give you general anwser how to deal with that :stuck_out_tongue: you sure you really made debugging (by that i mean run editor thru real C++ debugger)? because if you would did you would know on what exact line of code game is crashing, and allowing us (and you) to pin point where the problem.

In VS click Debug->Start Debugging or Attach to Process if you have editor already running (before crash ofcorse, also i know people have issues with running thru VS) and then when crash happens VS will react and dected that and then you can press Break and see call stack (a stack of calls that program currently executed, for example Main() called A() which called B() and currently doing Omega()) and where program stopped allowing you to find a issue.

This debugger debug machine code and it’s blind if there no PDB files which maps machine code to source code and in launcher version of UE4 you don’t have those. Thats why if you code in C++ on UE4 it’s recommended to use engine compiled from source, or else you might be lost. Also your code is not really isolated game code, in UE4 it’s practically integral part of engine code and your error may cause crash deeper in engine source, thats why it importent to investigate call stack, and you wont understand call stack without PDB files.

BUT, sometimes you can avoid all of that, sometimes if crash is expected and predictable by engine, it prints error message in log before printing call stack (which is also no readable without PDBs, so check that too.

Hi,

I’m calling a (BlueprintCallable) C++ function from a blueprint and that function calls other functions in the same class. But when doing so, I get an “access violation” crash in a packaged game. When running in PIE, everything had worked as intended, but after some debugging (and even returning to the previous working state), it now crashes in PIE, too. Commenting out all lines that access other variables or functions in that class makes it work but is not a usable workaround for me.

Any ideas on why this is happening? Thanks!

Yeah, I know it’s a bit general, but there really is nothing more to it. Yes, I’m debugging it and the line it is crashing at is always the first line I try to access either a variable or a function of that class (that is not a local variable created in the same function).

Because I encountered one bug after the other while trying to fix this issue, I completely reverted to an earlier commit and implemented all that stuff in blueprint, even if it is a bit ugly - but it works now.

Still, I’d be interested in finding out what that issue was… it even crashed when directly calling the function in the child blueprint of the class. I recently upgraded to 4.5, so that may have something to do with it…

Can yuou paste the code?