LennyPhoenix / GodotDiscordSDK

A Discord Game SDK wrapper for Godot, written in C.
MIT License
54 stars 5 forks source link

Resources still in use at exit #15

Open Cyxo opened 3 years ago

Cyxo commented 3 years ago

System Info

Describe the bug

I get the following message when closing the game (see below for the verbose log):

WARNING: cleanup: ObjectDB instances leaked at exit (run with --verbose for details).
     At: core/object.cpp:2132
ERROR: clear: Resources still in use at exit (run with --verbose for details).
   At: core/resource.cpp:450

To Reproduce

  1. Create the core in _ready
  2. Update the activity in _ready
  3. Run the callbacks in _process
  4. Close the game (using Alt+F4 or calling get_tree().quit())

Expected behaviour

No leaks

Additional context

Full verbose log at exit:

WARNING: cleanup: ObjectDB instances leaked at exit (run with --verbose for details).
     At: core/object.cpp:2132
Leaked instance: Resource:1449 - Resource path:
Leaked instance: Resource:1446 - Resource path:
Leaked instance: NativeScript:1280 - Resource path: res://discord_sdk/activity_timestamps.gdns
Leaked instance: Resource:1448 - Resource path:
Leaked instance: Resource:1450 - Resource path:
Leaked instance: NativeScript:1288 - Resource path: res://discord_sdk/activity_secrets.gdns
Leaked instance: NativeScript:1284 - Resource path: res://discord_sdk/party_size.gdns
Leaked instance: NativeScript:1286 - Resource path: res://discord_sdk/activity_party.gdns
Leaked instance: GDNativeLibrary:1232 - Resource path: res://discord_sdk/discord_game_sdk.gdnlib
Leaked instance: ConfigFile:1233
Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`).
ERROR: clear: Resources still in use at exit (run with --verbose for details).
   At: core/resource.cpp:450
Resource still in use: res://discord_sdk/party_size.gdns (NativeScript)
Resource still in use: res://discord_sdk/activity_timestamps.gdns (NativeScript)
Resource still in use: res://discord_sdk/activity_party.gdns (NativeScript)
Resource still in use: res://discord_sdk/activity_secrets.gdns (NativeScript)
Resource still in use: res://discord_sdk/discord_game_sdk.gdnlib (GDNativeLibrary)
Orphan StringName: NativeScript
Orphan StringName: GDNativeLibrary
Orphan StringName: Resource
Orphan StringName: ConfigFile
StringName: 4 unclaimed string names at exit.

Checklist

LennyPhoenix commented 3 years ago

I am aware of this issue, and it seems to be a problem with how Godot is dealing with the references. I will look for solutions, but this is something I have been unable to resolve for a while.

LennyPhoenix commented 2 years ago

Been experimenting with using godot-rust, I think the rust rewrite should fix this issue