I am new to UE4. Building from source with /EHsc set. Using boost asio, threading, some other boost stuff.
I was able to package last night, but as of changes I made today, I cannot. The logs are not very helpful to my untrained eye. I spent several hours looking around and trying various things but no success.
I can ‘Cook content for Windows’ and launch no problem.
Edit: Also may or may not be related. I will crash if I click the ‘compile’ button in the editor, instead of stopping, and compiling/relaunching the editor fresh from VS. This is cause by closing a socket in an actors destructor.
Edit 2: Ah! I noticed right before I crash that the packaging process is logging into my server?! This is also what is occurring in the ‘compile’ button crashes.
Edit 3: OK getting closer! So question. When does UE4 execute parts of my code when my game isn’t running, and what does it execute? I have been searching but can not seem to find answers.
So I am binding a class members (the inherited AGameMode class) shared pointer to a thread, to a make_shared thread created in that classes constructor, which takes a data member (io_service) of the class. I am joining that thread in the classes destructor. My problem seems to be in the constructor there. I can get around it by adding a data member ‘created’ etc that I set to true at the end of the constructor, and check before joining the thread in the destructor. I also have to do this in the class containing the socket, so the close function is not called in the inherited AGameMode classes destructor. However I have not yet structured this correctly, so I am still getting the same crash when not commenting out the socket owning class. I do have it packaging with just the thread though. Not sure what the proper what to handle this is, for now it works though. Very interested in the proper way, and also the question above in bold.
Edit 4: OK getting closer. I think the problem is that my socket containing class could possibly throw an exception, meaning the destructor may never be called?