Yogoda / ZoneLoadingSystem

Dynamic zone loading system for Godot
Creative Commons Zero v1.0 Universal
226 stars 13 forks source link

Freezes when trying to exit from outside the demo #15

Closed jbpuryear closed 2 years ago

jbpuryear commented 2 years ago

When trying to quit by closing the demo's window, it will freeze and refuse to exit if the background loader is running. Calling get_tree().set_auto_accept_quit(false) and adding the following method to BackgroundLoader appears to fix the issue.

func _notification(note):
    if note == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
        request_stop()
        yield(self, "_loading_process_stopped")
        get_tree().quit()
Yogoda commented 2 years ago

Thanks for the report!

It is weird, I never had this issue.

But ok, your change seems very reasonable, always cleanly stopping the thread before exiting.

I will try to implement it, thank you!

Yogoda commented 2 years ago

Ok, so instead of freezing I was getting the error "There are still MemoryPool allocs in use at exit!"

I was wondering what was causing that error, thank you very much for the fix! I committed the change, but there is not enough change for a new release I think.

Thank you! Joël

jbpuryear commented 2 years ago

I should have mentioned I'm running Linux, which is probably why it's freezing for me and not you. Also, I later realized that it's not actually necessary to set auto_accept_quit to false and call get_tree().quit(). It's enough to just exit the thread when receiving the quit notification.

Yogoda commented 2 years ago

cool, I updated the code