Hmm… I still encounter the issue without the specific reproduce step I mentioned, just continuous use of the engine hit case again on Mac OS X. I started to use source version and commented the SafeRelease() line in FTargetDeviceService::~~FTargetDeviceService(), as a fix. It never hits the problem again.
I made some observations:
- Mac OS X Only. I also tested binary version of UE4 Editor. The issue doesn’t occur.
- Editor Only. FTargetDeviceService is for developers. (I think?)
- MessageEndpoint is already ThreadSafe shared pointer what’s the point of this infinite loop in SafeRelease in FTargetDeviceService::~FTargetDeviceService()?
- The freeze (hanging) can be simulated whenever you create another FTargetDeviceService instead right before old FTargetDeviceService::~FTargetDeviceService() is invoked. Obviously, The code seems to be multi-threaded. I think this is the cause.
My fix works for me on Mac OS X. I cannot test all the platforms, and I don’t see the side effects from doing this specifically. So, I cannot do github pull request for this. But, I would put a comment here for reference.