Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING: cleanup: ObjectDB Instances still exist! when using GetWorld2d().DirectSpaceState #39216

Open
Tracked by #45334
quanixstudio opened this issue Jun 1, 2020 · 6 comments

Comments

@quanixstudio
Copy link

Godot version:
v3.2.2 beta3 mono
Also tried it on v3.2.1 stable mono with the same result.

OS/device including version:
Windows10

Issue description:
When using GetWorld2d().DirectSpaceState this error is shown when quitting the application.
WARNING: cleanup: ObjectDB Instances still exist! At: core/object.cpp:2135

Steps to reproduce:

  1. Generate new mono project.
  2. Add a node and attach a C# script to it.
  3. Save this as the main scene.
  4. In the script in _PhysicsProcess store the result of GetWorld2d().DirectSpaceState to a variable.
  5. Play the project and then quit.
@quanixstudio
Copy link
Author

After some playing around I found out that it is the GetWorld2d() that causes the warning.
If I do it like this the error is not showing anymore.

using Godot;

public class Test : Node2D {
    private World2D _world;

    public override void _ExitTree() {
        _world?.Dispose();
    }

    public override void _PhysicsProcess(float delta) {
        _world = GetWorld2d();
        var spaceState = _world.DirectSpaceState;
        // Do whatever you want with the spacestate
    }
}

@madmiraal
Copy link
Contributor

I'm unable to reproduce this issue. I've created a minimal reproduction project using the information provided:
39216.zip

I do not get the warning message in v3.2.1 or v3.2.2 beta 4.

@quanixstudio If you're able to provide your own minimal reproduction project that does show this warning, then please comment below.

@quanixstudio
Copy link
Author

I downloaded your example and using it that way gave me the warning.
After that I added the Dispose and the warning was gone.

In the attached screenshot, the first run was without dispose and the second with dispose.

godot

@madmiraal
Copy link
Contributor

madmiraal commented Jun 9, 2020

Looks like it may be OS specific. I'm using the x11_64 version. I see you're using the win64 version.

@pouleyKetchoupp
Copy link
Contributor

Confirmed in 3.2.3 stable on Windows 10. The issue is c# specific, I can't reproduce it when using gdscript instead.

@magian1127
Copy link
Contributor

3.4 There is still this problem.
windows 10 x64
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants