ProjectBorealis / UEGitPlugin

Unreal Engine Git Source Control Plugin (refactored)
MIT License
512 stars 104 forks source link

Fix thread crash on editor exit due to module unavailability #171 #172

Closed zhaozigu closed 3 months ago

zhaozigu commented 3 months ago

Pre-check to prevent assertion failure crash #171

mastercoms commented 3 months ago

Hi, thanks for the contribution! Do you know why this is being called by the fetch worker in the first place? Shouldn't it close without updating when the editor is exiting? I think that would be a better fix.

zhaozigu commented 3 months ago

Hi, thanks for the contribution! Do you know why this is being called by the fetch worker in the first place? Shouldn't it close without updating when the editor is exiting? I think that would be a better fix.

It's likely due to an unstable network connection combined with the time lag caused by multi-threading. This results in the update operation occurring after the user has already closed the editor.

mastercoms commented 3 months ago

Maybe it's better to keep a reference in the worker thread to the module, and release it on each update loop. I think this will hold the module until deref. That way we won't have to worry about any function we are calling needing to handle module.

zhaozigu commented 3 months ago

Perhaps we could consider using Unreal's subsystems, which would make the module's lifecycle simpler and more controllable. Of course, this is just my immature suggestion, as my understanding of this plugin's implementation is still quite limited.

mastercoms commented 3 months ago

That may be good! I will accept this PR for now though, if you add a TODO comment about more robust module handling.

zhaozigu commented 3 months ago

OK. I've added a comment.