From d85726043ef7a688a43e699cf58dcd41dd0dff0e Mon Sep 17 00:00:00 2001 From: x3 Date: Mon, 7 Sep 2026 16:02:30 +0000 Subject: [PATCH] Fix: crash on connect - invalid VTE signal 'size-changed' The signal 'size-changed' does not exist in VTE 2.91. This caused a GLib-GObject-CRITICAL warning followed by a segfault when connecting. Fixed by replacing the VTE signal with GTK's 'size-allocate' signal on the terminal widget, which correctly detects terminal size changes and resizes the remote PTY accordingly. --- src/ssh_terminal.cpp | 9 ++++++--- src/ssh_terminal.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ssh_terminal.cpp b/src/ssh_terminal.cpp index 6955d43..fdcb1b3 100644 --- a/src/ssh_terminal.cpp +++ b/src/ssh_terminal.cpp @@ -17,7 +17,7 @@ SshTerminal::SshTerminal() gtk_box_pack_start(GTK_BOX(vte_box_), GTK_WIDGET(terminal_), TRUE, TRUE, 0); gtk_widget_show_all(vte_box_); - g_signal_connect(terminal_, "size-changed", G_CALLBACK(on_size_changed), this); + g_signal_connect(terminal_, "size-allocate", G_CALLBACK(on_size_changed), this); } SshTerminal::~SshTerminal() { @@ -28,10 +28,13 @@ SshTerminal::~SshTerminal() { } } -void SshTerminal::on_size_changed(VteTerminal* term, guint cols, guint rows, gpointer data) { - (void)term; +void SshTerminal::on_size_changed(GtkWidget* widget, GtkAllocation* alloc, gpointer data) { + (void)alloc; auto* self = static_cast(data); if (self->channel_ && self->connected_) { + VteTerminal* term = VTE_TERMINAL(widget); + guint cols = vte_terminal_get_column_count(term); + guint rows = vte_terminal_get_row_count(term); ssh_channel_change_pty_size(self->channel_, cols, rows); } } diff --git a/src/ssh_terminal.h b/src/ssh_terminal.h index 199a3a0..da26213 100644 --- a/src/ssh_terminal.h +++ b/src/ssh_terminal.h @@ -25,7 +25,7 @@ public: private: void cleanup(); static gpointer io_thread_func(gpointer data); - static void on_size_changed(VteTerminal* term, guint cols, guint rows, gpointer data); + static void on_size_changed(GtkWidget* widget, GtkAllocation* alloc, gpointer data); GtkWidget* vte_box_; VteTerminal* terminal_;