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.
This commit is contained in:
@@ -17,7 +17,7 @@ SshTerminal::SshTerminal()
|
|||||||
gtk_box_pack_start(GTK_BOX(vte_box_), GTK_WIDGET(terminal_), TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vte_box_), GTK_WIDGET(terminal_), TRUE, TRUE, 0);
|
||||||
gtk_widget_show_all(vte_box_);
|
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() {
|
SshTerminal::~SshTerminal() {
|
||||||
@@ -28,10 +28,13 @@ SshTerminal::~SshTerminal() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshTerminal::on_size_changed(VteTerminal* term, guint cols, guint rows, gpointer data) {
|
void SshTerminal::on_size_changed(GtkWidget* widget, GtkAllocation* alloc, gpointer data) {
|
||||||
(void)term;
|
(void)alloc;
|
||||||
auto* self = static_cast<SshTerminal*>(data);
|
auto* self = static_cast<SshTerminal*>(data);
|
||||||
if (self->channel_ && self->connected_) {
|
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);
|
ssh_channel_change_pty_size(self->channel_, cols, rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void cleanup();
|
void cleanup();
|
||||||
static gpointer io_thread_func(gpointer data);
|
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_;
|
GtkWidget* vte_box_;
|
||||||
VteTerminal* terminal_;
|
VteTerminal* terminal_;
|
||||||
|
|||||||
Reference in New Issue
Block a user