diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-09-08 13:36:32 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-08 13:36:32 +0200 | 
| commit | 5cc8da9f182a7cdb2e46f33df91044f1512ccd39 (patch) | |
| tree | 0ae2708c74dde2e5a20dd71c4aeb3e6f23fbac67 | |
| parent | 0a8c5845e33de025f5bfcacbcb5cf1ff4fa9fc33 (diff) | |
| parent | 79802b31a99f2b7256ad6d22e664734ee3a11397 (diff) | |
Merge pull request #41876 from madmiraal/fix-40947
Check if old mouse column is still available.
| -rw-r--r-- | scene/gui/tree.cpp | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 5057f84192..f6636cf392 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2403,11 +2403,16 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {  				cache.hover_cell = col;  				if (it != old_it || col != old_col) { -					// Only need to update if mouse enters/exits a button -					bool was_over_button = old_it && old_it->cells[old_col].custom_button; -					bool is_over_button = it && it->cells[col].custom_button; -					if (was_over_button || is_over_button) { +					if (old_it && old_col >= old_it->cells.size()) { +						// Columns may have changed since last update().  						update(); +					} else { +						// Only need to update if mouse enters/exits a button +						bool was_over_button = old_it && old_it->cells[old_col].custom_button; +						bool is_over_button = it && it->cells[col].custom_button; +						if (was_over_button || is_over_button) { +							update(); +						}  					}  				}  			}  |