summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2020-01-24 11:16:40 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2020-01-24 11:17:56 +0800
commit0ca102d568e860def5d505dab863a712a5d07f35 (patch)
tree3366fac0a8618afcb26e2bb5b728739f40edb7b4 /editor
parent8a7a216be5dfbd8e2b7f32c39a92bbecec9306ca (diff)
Fixes leak in Animation Track editor
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 22a5298d5c..e9719f8618 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -4839,19 +4839,22 @@ struct _AnimMoveRestore {
void AnimationTrackEditor::_clear_key_edit() {
if (key_edit) {
//if key edit is the object being inspected, remove it first
- if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit ||
- EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) {
+ if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) {
EditorNode::get_singleton()->push_item(NULL);
}
//then actually delete it
- if (key_edit) {
- memdelete(key_edit);
- key_edit = NULL;
- } else if (multi_key_edit) {
- memdelete(multi_key_edit);
- multi_key_edit = NULL;
+ memdelete(key_edit);
+ key_edit = NULL;
+ }
+
+ if (multi_key_edit) {
+ if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) {
+ EditorNode::get_singleton()->push_item(NULL);
}
+
+ memdelete(multi_key_edit);
+ multi_key_edit = NULL;
}
}
@@ -4907,7 +4910,7 @@ void AnimationTrackEditor::_update_key_edit() {
if (!key_ofs_map.has(track)) {
key_ofs_map[track] = List<float>();
- base_map[track] = *memnew(NodePath);
+ base_map[track] = NodePath();
}
key_ofs_map[track].push_back(animation->track_get_key_time(track, E->key().key));
@@ -5974,6 +5977,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
keying = false;
moving_selection = 0;
key_edit = NULL;
+ multi_key_edit = NULL;
box_selection = memnew(Control);
add_child(box_selection);
@@ -6085,4 +6089,7 @@ AnimationTrackEditor::~AnimationTrackEditor() {
if (key_edit) {
memdelete(key_edit);
}
+ if (multi_key_edit) {
+ memdelete(multi_key_edit);
+ }
}