Merge pull request #47636 from qarmin/input

Fix crashes in *_input functions
This commit is contained in:
Rémi Verschelde 2021-04-05 11:54:08 +02:00 committed by GitHub
commit 77dc4c3cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 103 additions and 0 deletions

View file

@ -602,6 +602,8 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int
} }
void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) { if (p_event->is_pressed()) {
if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
duplicate_selection(); duplicate_selection();

View file

@ -1641,6 +1641,8 @@ void AnimationTimelineEdit::_play_position_draw() {
} }
void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) { void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
@ -2522,6 +2524,8 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
} }
void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) { if (p_event->is_pressed()) {
if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
emit_signal("duplicate_request"); emit_signal("duplicate_request");

View file

@ -1036,6 +1036,8 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant
} }
void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) { void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event; Ref<InputEventMouseMotion> mm = p_event;
if (!len_resizing && mm.is_valid()) { if (!len_resizing && mm.is_valid()) {
bool use_hsize_cursor = false; bool use_hsize_cursor = false;

View file

@ -109,6 +109,8 @@ void FindReplaceBar::_notification(int p_what) {
} }
void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) { void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (!k.is_valid() || !k->is_pressed()) { if (!k.is_valid() || !k->is_pressed()) {
return; return;
@ -691,6 +693,8 @@ FindReplaceBar::FindReplaceBar() {
// This function should be used to handle shortcuts that could otherwise // This function should be used to handle shortcuts that could otherwise
// be handled too late if they weren't handled here. // be handled too late if they weren't handled here.
void CodeTextEditor::_input(const Ref<InputEvent> &event) { void CodeTextEditor::_input(const Ref<InputEvent> &event) {
ERR_FAIL_COND(event.is_null());
const Ref<InputEventKey> key_event = event; const Ref<InputEventKey> key_event = event;
if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) {
return; return;

View file

@ -531,6 +531,8 @@ void EditorAudioBus::_effect_add(int p_which) {
} }
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) { void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);

View file

@ -125,6 +125,8 @@ void EditorFileDialog::_notification(int p_what) {
} }
void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (k.is_valid()) { if (k.is_valid()) {

View file

@ -1908,6 +1908,8 @@ void FindBar::_hide_bar() {
} }
void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) { void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (k.is_valid()) { if (k.is_valid()) {
if (k->is_pressed() && (rich_text_label->has_focus() || is_a_parent_of(get_focus_owner()))) { if (k->is_pressed() && (rich_text_label->has_focus() || is_a_parent_of(get_focus_owner()))) {

View file

@ -682,6 +682,8 @@ bool EditorProperty::is_selected() const {
} }
void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) { void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (property == StringName()) { if (property == StringName()) {
return; return;
} }
@ -1354,6 +1356,8 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
} }
void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) { void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!foldable) { if (!foldable) {
return; return;
} }

View file

@ -390,6 +390,8 @@ void EditorNode::_update_title() {
} }
void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) { void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_pressed() && !k->is_echo()) { if (k.is_valid() && k->is_pressed() && !k->is_echo()) {
EditorPlugin *old_editor = editor_plugin_screen; EditorPlugin *old_editor = editor_plugin_screen;

View file

@ -47,6 +47,8 @@ String EditorSpinSlider::get_text_value() const {
} }
void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (read_only) { if (read_only) {
return; return;
} }

View file

@ -1219,6 +1219,8 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
} }
void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev; Ref<InputEventKey> k = p_ev;
if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) { if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) {
switch (k->get_keycode()) { switch (k->get_keycode()) {

View file

@ -613,6 +613,8 @@ void EditorAssetLibrary::_update_repository_options() {
} }
void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) { void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventKey> key = p_event; const Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed()) { if (key.is_valid() && key->is_pressed()) {

View file

@ -472,6 +472,8 @@ float CanvasItemEditor::snap_angle(float p_target, float p_start) const {
} }
void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev; Ref<InputEventKey> k = p_ev;
if (!is_visible_in_tree()) { if (!is_visible_in_tree()) {

View file

@ -33,6 +33,8 @@
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
void MeshEditor::_gui_input(Ref<InputEvent> p_event) { void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event; Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
rot_x -= mm->get_relative().y * 0.01; rot_x -= mm->get_relative().y * 0.01;

View file

@ -185,6 +185,8 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
} }
void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) { void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventMouseButton> mb = p_event; const Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
Vector2 pos = mb->get_position(); Vector2 pos = mb->get_position();
@ -4192,6 +4194,8 @@ Node3DEditorViewport::~Node3DEditorViewport() {
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) { void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@ -6159,6 +6163,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
} }
void Node3DEditor::_unhandled_key_input(Ref<InputEvent> p_event) { void Node3DEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_visible_in_tree()) { if (!is_visible_in_tree()) {
return; return;
} }

View file

@ -2706,6 +2706,8 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
} }
void ScriptEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) { void ScriptEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) { if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) {
return; return;
} }

View file

@ -35,6 +35,8 @@
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) { void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event; Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
y_rot += -mm->get_relative().x * 0.01; y_rot += -mm->get_relative().x * 0.01;

View file

@ -1882,6 +1882,8 @@ void ProjectManager::_update_project_buttons() {
} }
void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) { void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev; Ref<InputEventKey> k = p_ev;
if (k.is_valid()) { if (k.is_valid()) {

View file

@ -61,6 +61,8 @@ void SceneTreeDock::_quick_open() {
} }
void SceneTreeDock::_input(Ref<InputEvent> p_event) { void SceneTreeDock::_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@ -69,6 +71,8 @@ void SceneTreeDock::_input(Ref<InputEvent> p_event) {
} }
void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) { void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (get_focus_owner() && get_focus_owner()->is_text_field()) { if (get_focus_owner() && get_focus_owner()->is_text_field()) {
return; return;
} }

View file

@ -139,6 +139,8 @@ void EditorSettingsDialog::_notification(int p_what) {
} }
void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventKey> k = p_event; const Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_pressed()) { if (k.is_valid() && k->is_pressed()) {

View file

@ -1826,6 +1826,8 @@ void VisualScriptEditor::_generic_search(String p_base_type, Vector2 pos, bool n
} }
void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) { void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
// GUI input for VS Editor Plugin // GUI input for VS Editor Plugin
Ref<InputEventMouseButton> key = p_event; Ref<InputEventMouseButton> key = p_event;

View file

@ -189,6 +189,8 @@ String TouchScreenButton::get_action() const {
} }
void TouchScreenButton::_input(const Ref<InputEvent> &p_event) { void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!get_tree()) { if (!get_tree()) {
return; return;
} }

View file

@ -53,6 +53,8 @@ void BaseButton::_unpress_group() {
} }
void BaseButton::_gui_input(Ref<InputEvent> p_event) { void BaseButton::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (status.disabled) { // no interaction with disabled button if (status.disabled) { // no interaction with disabled button
return; return;
} }
@ -323,6 +325,8 @@ Ref<Shortcut> BaseButton::get_shortcut() const {
} }
void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) { void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!_is_focus_owner_in_shorcut_context()) { if (!_is_focus_owner_in_shorcut_context()) {
return; return;
} }

View file

@ -96,6 +96,8 @@ void FileDialog::_notification(int p_what) {
} }
void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (k.is_valid() && has_focus()) { if (k.is_valid() && has_focus()) {
if (k->is_pressed()) { if (k->is_pressed()) {

View file

@ -92,6 +92,8 @@ GradientEdit::~GradientEdit() {
} }
void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) { if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) {

View file

@ -154,6 +154,8 @@ Vector2 GraphEditMinimap::_convert_to_graph_position(const Vector2 &p_position)
} }
void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) { void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
if (!ge->is_minimap_enabled()) { if (!ge->is_minimap_enabled()) {
return; return;
} }
@ -1066,6 +1068,8 @@ void GraphEdit::set_selected(Node *p_child) {
} }
void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventMouseMotion> mm = p_ev; Ref<InputEventMouseMotion> mm = p_ev;
if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);

View file

@ -804,6 +804,8 @@ Color GraphNode::get_connection_output_color(int p_idx) {
} }
void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) { void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventMouseButton> mb = p_ev; Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid()) { if (mb.is_valid()) {
ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node."); ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");

View file

@ -530,6 +530,8 @@ Size2 ItemList::Item::get_icon_size() const {
} }
void ItemList::_gui_input(const Ref<InputEvent> &p_event) { void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
double prev_scroll = scroll_bar->get_value(); double prev_scroll = scroll_bar->get_value();
Ref<InputEventMouseMotion> mm = p_event; Ref<InputEventMouseMotion> mm = p_event;

View file

@ -215,6 +215,8 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) {
} }
void LineEdit::_gui_input(Ref<InputEvent> p_event) { void LineEdit::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> b = p_event; Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) { if (b.is_valid()) {

View file

@ -34,6 +34,8 @@
#include "scene/main/window.h" #include "scene/main/window.h"
void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) { void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!_is_focus_owner_in_shorcut_context()) { if (!_is_focus_owner_in_shorcut_context()) {
return; return;
} }

View file

@ -252,6 +252,8 @@ void PopupMenu::_submenu_timeout() {
} }
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_action("ui_down") && p_event->is_pressed()) { if (p_event->is_action("ui_down") && p_event->is_pressed()) {
int search_from = mouse_over + 1; int search_from = mouse_over + 1;
if (search_from >= items.size()) { if (search_from >= items.size()) {

View file

@ -1469,6 +1469,8 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const
} }
void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> b = p_event; Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) { if (b.is_valid()) {

View file

@ -42,6 +42,8 @@ void ScrollBar::set_can_focus_by_default(bool p_can_focus) {
} }
void ScrollBar::_gui_input(Ref<InputEvent> p_event) { void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> m = p_event; Ref<InputEventMouseMotion> m = p_event;
if (!m.is_valid() || drag.active) { if (!m.is_valid() || drag.active) {
emit_signal("scrolling"); emit_signal("scrolling");

View file

@ -88,6 +88,8 @@ void ScrollContainer::_cancel_drag() {
} }
void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
ERR_FAIL_COND(p_gui_input.is_null());
double prev_v_scroll = v_scroll->get_value(); double prev_v_scroll = v_scroll->get_value();
double prev_h_scroll = h_scroll->get_value(); double prev_h_scroll = h_scroll->get_value();

View file

@ -46,6 +46,8 @@ Size2 Slider::get_minimum_size() const {
} }
void Slider::_gui_input(Ref<InputEvent> p_event) { void Slider::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!editable) { if (!editable) {
return; return;
} }

View file

@ -100,6 +100,8 @@ void SpinBox::_release_mouse() {
} }
void SpinBox::_gui_input(const Ref<InputEvent> &p_event) { void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_editable()) { if (!is_editable()) {
return; return;
} }

View file

@ -207,6 +207,8 @@ void SplitContainer::_notification(int p_what) {
} }
void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) { if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) {
return; return;
} }

View file

@ -140,6 +140,8 @@ void SubViewportContainer::_notification(int p_what) {
} }
void SubViewportContainer::_input(const Ref<InputEvent> &p_event) { void SubViewportContainer::_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (Engine::get_singleton()->is_editor_hint()) { if (Engine::get_singleton()->is_editor_hint()) {
return; return;
} }
@ -165,6 +167,8 @@ void SubViewportContainer::_input(const Ref<InputEvent> &p_event) {
} }
void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) { void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (Engine::get_singleton()->is_editor_hint()) { if (Engine::get_singleton()->is_editor_hint()) {
return; return;
} }

View file

@ -72,6 +72,8 @@ int TabContainer::_get_top_margin() const {
} }
void TabContainer::_gui_input(const Ref<InputEvent> &p_event) { void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
Popup *popup = get_popup(); Popup *popup = get_popup();

View file

@ -91,6 +91,8 @@ Size2 Tabs::get_minimum_size() const {
} }
void Tabs::_gui_input(const Ref<InputEvent> &p_event) { void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event; Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) { if (mm.is_valid()) {

View file

@ -2854,6 +2854,8 @@ void TextEdit::_get_minimap_mouse_row(const Point2i &p_mouse, int &r_row) const
} }
void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
ERR_FAIL_COND(p_gui_input.is_null());
double prev_v_scroll = v_scroll->get_value(); double prev_v_scroll = v_scroll->get_value();
double prev_h_scroll = h_scroll->get_value(); double prev_h_scroll = h_scroll->get_value();

View file

@ -2402,6 +2402,8 @@ void Tree::_go_down() {
} }
void Tree::_gui_input(Ref<InputEvent> p_event) { void Tree::_gui_input(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
bool is_command = k.is_valid() && k->get_command(); bool is_command = k.is_valid() && k->get_command();

View file

@ -3067,6 +3067,7 @@ void Viewport::input(const Ref<InputEvent> &p_event, bool p_local_coords) {
} }
void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords) { void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
ERR_FAIL_COND(p_event.is_null());
ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!is_inside_tree());
if (disable_input || !_can_consume_input_events()) { if (disable_input || !_can_consume_input_events()) {