Hello, on my title screen of my game, there is a Quit Button that calls get_tree().quit() when clicked. If one opens the credits menu then closes it by pressing the Back Button, and then presses the Quit Button the following error is shown in console:

ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112
WARNING: cleanup: ObjectDB Instances still exist!
     At: core/object.cpp:2071
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:476
ERROR: There are still MemoryPool allocs in use at exit!
   At: core/pool_vector.cpp:69

Does anyone know why this is?

8 days later

your credits menu must allocate objects that do not get properly disposed of when you close the menu. What "special" allocations are you doing there? Make sure you dispose of them when your credit menu quits/disposes

15 days later

I figured out I had to queue_free() before adding in the new nodes. That fixed my issue. Thanks y'all!

Here's how the final code looked like:

var credits_menu = "/My Path To My Credits Menu.tscn"

func _on_CreditsButton_button_up(): # User clicks to open the credits menu
	queue_free() # old menu closes
	get_parent().add_child(credits_menu.instance()) # Creates credits menu node.
3 years later