Merge pull request #23537 from fire/visualscript-virtual-_function-crash-23536

Fix creating a visual script virtual function after minimizing crashes #23536 and misc vs warning
This commit is contained in:
Rémi Verschelde 2018-11-06 22:13:19 +01:00 committed by GitHub
commit 1e6537bcc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -3653,7 +3653,7 @@ VisualScriptEditor::VisualScriptEditor() {
new_virtual_method_select = memnew(VisualScriptPropertySelector);
add_child(new_virtual_method_select);
new_virtual_method_select->connect("selected", this, "_selected_new_virtual_method");
new_virtual_method_select->get_cancel()->connect("pressed", this, "_selected_new_virtual_method");
new_virtual_method_select->get_cancel();
member_popup = memnew(PopupMenu);
add_child(member_popup);

View File

@ -176,7 +176,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _cancel_connect_node();
void _create_new_node(const String &p_text, const String &p_category, const Vector2 &p_point);
void _selected_new_virtual_method(const String &p_text = String(""), const String &p_category = String(""), const bool p_connecting = true);
void _selected_new_virtual_method(const String &p_text, const String &p_category, const bool p_connecting);
int error_line;

View File

@ -2519,7 +2519,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
pressing_for_editor = false;
}
if (cache.click_type == Cache::CLICK_BUTTON) {
if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != NULL) {
// make sure in case of wrong reference after reconstructing whole TreeItems
cache.click_item = get_item_at_position(cache.click_pos);
emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);