### Godot version

master ([06ccbfe](https://github.com/godotengine/godot/commit/06ccbfe8eec6e840db3df2360dc2804386f940b8))

### System information

PopOS 22.04

### Issue description

Sometimes the doc page is broken when the engine is closed and then restarted.
Closing the doc and opening it again fixes it.

![2023-05-27_22-15](https://github.com/godotengine/godot/assets/3624853/ed202a55-03e8-420a-bc1c-ccfc7f7cd02a)


### Steps to reproduce

- Open a documentation page for any node
- Restart Godot

### Minimal reproduction project

NA

EDIT : Added the commit hash @Calinou 
int processed_glyphs = 0;
			while (ofs.y < size.height && from_line < to_line) {
				MutexLock lock(main->lines[from_line].text_buf->get_mutex());
				visible_paragraph_count++;
				visible_line_count += _draw_line(main, from_line, ofs, text_rect.size.x, theme_cache.default_color, theme_cache.outline_size, theme_cache.font_outline_color, theme_cache.font_shadow_color, theme_cache.shadow_outline_size, shadow_ofs, processed_glyphs);
				ofs.y += main->lines[from_line].text_buf->get_size().y + main->lines[from_line].text_buf->get_line_count() * theme_cache.line_separation;
				from_line++;
			}
		} break;
		case NOTIFICATION_INTERNAL_PROCESS: {
			if (is_visible_in_tree()) {
				if (!is_ready()) {
					return;
				}
				double dt = get_process_delta_time();
				_update_fx(main, dt);
				queue_redraw();
			}
		} break;
		case NOTIFICATION_FOCUS_EXIT: {
			if (deselect_on_focus_loss_enabled) {
				deselect();
			}
		} break;
		case NOTIFICATION_DRAG_END: {
			selection.drag_attempt = false;
		} break;
	}
}
Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const {