Repository: godot
Issue: Memory leak when reverting type changing
Labels: bug,topic:core,confirmed,topic:gui

**Godot version:**
3.2 beta 4
**OS/device including version:**
Ubuntu 19.10
**Issue description:**
Leak info from Leak Sanitizer
```
Indirect leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f843360dae8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8)
    #1 0xea532ff in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
    #2 0x140886a in DefaultAllocator::alloc(unsigned long) core/os/memory.h:65
    #3 0xea53221 in operator new(unsigned long, void* (*)(unsigned long)) core/os/memory.cpp:47
    #4 0x9ca5135 in Set<Range*, Comparator<Range*>, DefaultAllocator>::_insert(Range* const&) core/set.h:333
    #5 0x9ca3bbf in Set<Range*, Comparator<Range*>, DefaultAllocator>::insert(Range* const&) core/set.h:536
    #6 0x9ca2332 in Range::Range() scene/gui/range.cpp:335
    #7 0x9dd3f9e in ScrollBar::ScrollBar(Orientation) scene/gui/scroll_bar.cpp:662
    #8 0x717301a in VScrollBar::VScrollBar() scene/gui/scroll_bar.h:128
    #9 0x9a793f3 in ItemList::ItemList() scene/gui/item_list.cpp:1598
    #10 0x9247ff6 in Object* ClassDB::creator<ItemList>() (/usr/bin/godots+0x9247ff6)
    #11 0xe2c5fd6 in ClassDB::instance(StringName const&) core/class_db.cpp:541
    #12 0x583e455 in CreateDialog::instance_selected() editor/create_dialog.cpp:547
    #13 0x6900e26 in SceneTreeDock::_do_create(Node*) editor/scene_tree_dock.cpp:1934
    #14 0x6908cf2 in SceneTreeDock::_create() editor/scene_tree_dock.cpp:1999
    #15 0x178d360 in MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:59
    #16 0xe52a5cc in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:921
    #17 0xe533fc4 in Object::emit_signal(StringName const&, Variant const**, int) core/object.cpp:1219
    #18 0xe535f8b in Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:1276
    #19 0x583978e in CreateDialog::_confirmed() editor/create_dialog.cpp:463
    #20 0x178d360 in MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:59
    #21 0xe52a5cc in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:921
    #22 0xe533fc4 in Object::emit_signal(StringName const&, Variant const**, int) core/object.cpp:1219
    #23 0xe535f8b in Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:1276
    #24 0xa1f515f in Tree::_gui_input(Ref<InputEvent>) scene/gui/tree.cpp:2720
    #25 0x647ce71 in MethodBind1<Ref<InputEvent> >::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:775
    #26 0xe5261e0 in Object::call_multilevel(StringName const&, Variant const**, int) core/object.cpp:763
    #27 0xe5292eb in Object::call_multilevel(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:863
    #28 0x950d202 in Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) scene/main/viewport.cpp:1634
    #29 0x951958e in Viewport::_gui_input_event(Ref<InputEvent>) scene/main/viewport.cpp:1944

Indirect leak of 1256 byte(s) in 1 object(s) allocated from:
    #0 0x7f843360dae8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dae8)
    #1 0xea532ff in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
    #2 0xea531fe in operator new(unsigned long, char const*) core/os/memory.cpp:42
    #3 0x9a793c6 in ItemList::ItemList() scene/gui/item_list.cpp:1598
    #4 0x9247ff6 in Object* ClassDB::creator<ItemList>() (/usr/bin/godots+0x9247ff6)
    #5 0xe2c5fd6 in ClassDB::instance(StringName const&) core/class_db.cpp:541
    #6 0x583e455 in CreateDialog::instance_selected() editor/create_dialog.cpp:547
    #7 0x6900e26 in SceneTreeDock::_do_create(Node*) editor/scene_tree_dock.cpp:1934
    #8 0x6908cf2 in SceneTreeDock::_create() editor/scene_tree_dock.cpp:1999
    #9 0x178d360 in MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:59
    #10 0xe52a5cc in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:921
    #11 0xe533fc4 in Object::emit_signal(StringName const&, Variant const**, int) core/object.cpp:1219
    #12 0xe535f8b in Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:1276
    #13 0x583978e in CreateDialog::_confirmed() editor/create_dialog.cpp:463
    #14 0x178d360 in MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:59
    #15 0xe52a5cc in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:921
    #16 0xe533fc4 in Object::emit_signal(StringName const&, Variant const**, int) core/object.cpp:1219
    #17 0xe535f8b in Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:1276
    #18 0xa1f515f in Tree::_gui_input(Ref<InputEvent>) scene/gui/tree.cpp:2720
    #19 0x647ce71 in MethodBind1<Ref<InputEvent> >::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:775
    #20 0xe5261e0 in Object::call_multilevel(StringName const&, Variant const**, int) core/object.cpp:763
    #21 0xe5292eb in Object::call_multilevel(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:863
    #22 0x950d202 in Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) scene/main/viewport.cpp:1634
    #23 0x951958e in Viewport::_gui_input_event(Ref<InputEvent>) scene/main/viewport.cpp:1944
    #24 0x9540d8d in Viewport::input(Ref<InputEvent> const&) scene/main/viewport.cpp:2790
    #25 0x9500b3a in Viewport::_vp_input(Ref<InputEvent> const&) scene/main/viewport.cpp:1411
    #26 0x234cd1d in MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) core/method_bind.gen.inc:775
    #27 0xe52a5cc in Object::call(StringName const&, Variant const**, int, Variant::CallError&) core/object.cpp:921
    #28 0xe528d1d in Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) core/object.cpp:847
    #29 0x93efa59 in SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) scene/main/scene_tree.cpp:275


```
**Steps to reproduce:**
1. Create ItemList
2. Save scene
3. Change type of ItemList to Label
4. Revert change with CTRL + Z
5. Close Godot