Skip to content

Dictionary contents were not destructed propery #338

Open

Description

@yosagi

I tried to access InputMap via ProjectSettings with following code.

Variant action_v = ProjectSettings::get_singleton()->get(String("input/ui_up"));
Dictionary action = action_v;
// do something with "action"

I expected "action" is property destructed when it goes out of scope. But the code leaks something and the engine report them on exit.

WARNING: ObjectDB::cleanup: ObjectDB Instances still exist!
     At: core\object.cpp:2069
Leaked instance: InputEventJoypadButton:35 - Resource name:  Path:
Leaked instance: InputEventKey:34 - Resource name:  Path:
Orphan StringName: InputEventKey
Orphan StringName: InputEventJoypadButton
StringName: 2 unclaimed string names at exit.

If I manually clear the Dictionary, no leak is reported.

Variant action_v = ProjectSettings::get_singleton()->get(String("input/ui_up"));
Dictionary action = action_v;
action.clear();

Version: godot (3.1.1.stable.official) + godot-cpp(cdd5026)
Version: godot (3.2.alpha.custom_build.8c3a5057c) + godot-cpp(123d9f0)
Platform: windows10, 64bit build

Activity

  1. yosagi commented on Oct 24, 2019

    @yosagi
    Author

    I found Array also requires manual clear().

    Variant action_v = ProjectSettings::get_singleton()->get(String("input/ui_up"));
    Dictionary action = action_v;
    Array events = action["events"];
    action.clear();
    

    With this code, the engine reports some leaks.

    WARNING: ObjectDB::cleanup: ObjectDB Instances still exist!
         At: core\object.cpp:2069
    Leaked instance: InputEventJoypadButton:35 - Resource name:  Path:
    Leaked instance: InputEventKey:34 - Resource name:  Path:
    Orphan StringName: InputEventKey
    Orphan StringName: InputEventJoypadButton
    StringName: 2 unclaimed string names at exit.
    

    If I add

    events.clear();
    

    at the end of the code above, no leaks reported.

  2. Zylann commented on Jun 10, 2020

    @Zylann
    Collaborator

    Does it still happen after ceae5be ?

  3. added
    bug
    on Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions