Fix: sidebar refresh after edit, crash on connect, live log, uninstall script

- Fix sidebar disappearing after edit: add gtk_widget_show_all after rebuild
- Fix crash on connect: flush pending GLib idle callbacks in disconnect()
- Fix single-click: explicitly set activate_on_single_click to FALSE
- Add live log output when started from terminal (stderr + ~/.config/sshclient/x3-ssh.log)
- Add logging to SSH connect, auth, and key operations
- Add uninstall.sh script to remove system-wide installation
This commit is contained in:
x3
2026-09-07 15:50:11 +00:00
parent 6e719c3236
commit fe7050c018
4 changed files with 169 additions and 1 deletions
+11 -1
View File
@@ -141,8 +141,10 @@ bool SshTerminal::connect(const std::string& host, int port, const std::string&
pty_slave_ = -1;
vte_pty_ = nullptr;
g_message("Connecting to %s:%d as %s ...", host.c_str(), port, user.c_str());
session_ = ssh_new();
if (!session_) return false;
if (!session_) { g_warning("ssh_new() failed"); return false; }
ssh_options_set(session_, SSH_OPTIONS_HOST, host.c_str());
unsigned int p = port;
@@ -153,6 +155,7 @@ bool SshTerminal::connect(const std::string& host, int port, const std::string&
if (ssh_connect(session_) != SSH_OK) {
std::string err = ssh_get_error(session_);
g_warning("ssh_connect failed: %s", err.c_str());
/* Manually free since cleanup_done_ is still true */
ssh_free(session_);
session_ = nullptr;
@@ -177,6 +180,7 @@ bool SshTerminal::connect(const std::string& host, int port, const std::string&
int rc = ssh_userauth_password(session_, nullptr, password.c_str());
if (rc != SSH_AUTH_SUCCESS) {
std::string err = ssh_get_error(session_);
g_warning("Auth failed: %s", err.c_str());
ssh_disconnect(session_);
ssh_free(session_);
session_ = nullptr;
@@ -256,6 +260,7 @@ auth_done:
cleanup_done_ = false;
connected_ = true;
running_ = true;
g_message("SSH connection established, starting IO thread");
thread_ = g_thread_new("ssh_io", io_thread_func, this);
if (on_status_change) on_status_change(true, "Connected to " + user + "@" + host);
@@ -270,6 +275,11 @@ void SshTerminal::disconnect() {
thread_ = nullptr;
}
/* Flush any pending idle callbacks from the IO thread
that might still reference this object */
while (g_main_context_pending(NULL))
g_main_context_iteration(NULL, FALSE);
if (vte_pty_) {
g_object_unref(vte_pty_);
vte_pty_ = nullptr;