diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2022-07-27 15:42:47 +0400 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2022-07-27 23:34:33 +0400 |
commit | 08d71a30d4feb8596a9ca3b39ab1c73bc6ecff10 (patch) | |
tree | af5f5201d03eb398badd7e8f3419738e243f0749 | |
parent | 2d165b61f527472a7a7eccee3e94f8ec96690245 (diff) | |
download | vte-08d71a30d4feb8596a9ca3b39ab1c73bc6ecff10.tar.gz |
widget: Don't queue_resize() during allocation
This is not allowed, and while here it mostly works by accident, it's
possible to break it - for example, if it resizes while unmapped.
See https://gitlab.gnome.org/GNOME/console/-/merge_requests/102#note_1510384
-rw-r--r-- | src/vte.cc | 16 | ||||
-rw-r--r-- | src/vtegtk.cc | 2 | ||||
-rw-r--r-- | src/vteinternal.hh | 3 |
3 files changed, 13 insertions, 8 deletions
@@ -7543,7 +7543,8 @@ Terminal::screen_set_size(VteScreen *screen_, void Terminal::set_size(long columns, - long rows) + long rows, + bool allocating) { glong old_columns, old_rows; @@ -7592,11 +7593,14 @@ Terminal::set_size(long columns, _vte_ring_next (m_screen->row_data) - 1)); adjust_adjustments_full(); + if (!allocating) { #if VTE_GTK == 3 - gtk_widget_queue_resize_no_redraw(m_widget); + gtk_widget_queue_resize_no_redraw(m_widget); #elif VTE_GTK == 4 - gtk_widget_queue_resize(m_widget); // FIXMEgtk4? + gtk_widget_queue_resize(m_widget); // FIXMEgtk4? #endif + } + /* Our visible text changed. */ emit_text_modified(); } @@ -7692,7 +7696,7 @@ Terminal::Terminal(vte::platform::Widget* w, /* Setting the terminal type and size requires the PTY master to * be set up properly first. */ - set_size(VTE_COLUMNS, VTE_ROWS); + set_size(VTE_COLUMNS, VTE_ROWS, false); /* Default is 0, forces update in vte_terminal_set_scrollback_lines */ set_scrollback_lines(VTE_SCROLLBACK_INIT); @@ -7874,7 +7878,7 @@ Terminal::widget_size_allocate( grid_height != m_row_count || update_scrollback) { /* Set the size of the pseudo-terminal. */ - set_size(grid_width, grid_height); + set_size(grid_width, grid_height, true); /* Notify viewers that the contents have changed. */ queue_contents_changed(); @@ -10140,7 +10144,7 @@ Terminal::set_pty(vte::base::Pty *new_pty) if (!new_pty) return true; - set_size(m_column_count, m_row_count); + set_size(m_column_count, m_row_count, false); if (!pty()->set_utf8(primary_data_syntax() == DataSyntax::ECMA48_UTF8)) { // nothing we can do here diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 235faac9..6e325654 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -4479,7 +4479,7 @@ try g_return_if_fail(columns >= 1); g_return_if_fail(rows >= 1); - IMPL(terminal)->set_size(columns, rows); + IMPL(terminal)->set_size(columns, rows, false); } catch (...) { diff --git a/src/vteinternal.hh b/src/vteinternal.hh index fbe696b1..88464760 100644 --- a/src/vteinternal.hh +++ b/src/vteinternal.hh @@ -1351,7 +1351,8 @@ public: bool search_set_wrap_around(bool wrap); void set_size(long columns, - long rows); + long rows, + bool allocating); std::optional<std::vector<char32_t>> process_word_char_exceptions(std::string_view str) const noexcept; |