summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/rich_text_label.cpp11
-rw-r--r--scene/gui/rich_text_label.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 81ef8dee36..cf7b6cf608 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2697,6 +2697,10 @@ bool RichTextLabel::is_ready() const {
return (main->first_invalid_line.load() == (int)main->lines.size() && main->first_resized_line.load() == (int)main->lines.size() && main->first_invalid_font_line.load() == (int)main->lines.size());
}
+bool RichTextLabel::is_updating() const {
+ return updating.load() || validating.load();
+}
+
void RichTextLabel::set_threaded(bool p_threaded) {
if (threaded != p_threaded) {
_stop_thread();
@@ -2721,6 +2725,7 @@ bool RichTextLabel::_validate_line_caches() {
if (updating.load()) {
return false;
}
+ validating.store(true);
if (main->first_invalid_line.load() == (int)main->lines.size()) {
MutexLock data_lock(data_mutex);
Rect2 text_rect = _get_text_rect();
@@ -2739,6 +2744,7 @@ bool RichTextLabel::_validate_line_caches() {
if (main->first_resized_line.load() == (int)main->lines.size()) {
vscroll->set_value(old_scroll);
+ validating.store(false);
return true;
}
@@ -2790,8 +2796,10 @@ bool RichTextLabel::_validate_line_caches() {
if (fit_content) {
update_minimum_size();
}
+ validating.store(false);
return true;
}
+ validating.store(false);
stop_thread.store(false);
if (threaded) {
updating.store(true);
@@ -2801,7 +2809,9 @@ bool RichTextLabel::_validate_line_caches() {
loading_started = OS::get_singleton()->get_ticks_msec();
return false;
} else {
+ updating.store(true);
_process_line_caches();
+ updating.store(false);
queue_redraw();
return true;
}
@@ -5882,6 +5892,7 @@ RichTextLabel::RichTextLabel(const String &p_text) {
set_text(p_text);
updating.store(false);
+ validating.store(false);
stop_thread.store(false);
set_clip_contents(true);
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 1dae8b75ca..5a9a8478b7 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -376,6 +376,7 @@ private:
bool threaded = false;
std::atomic<bool> stop_thread;
std::atomic<bool> updating;
+ std::atomic<bool> validating;
std::atomic<double> loaded;
uint64_t loading_started = 0;
@@ -679,6 +680,7 @@ public:
void deselect();
bool is_ready() const;
+ bool is_updating() const;
void set_threaded(bool p_threaded);
bool is_threaded() const;