Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::Path;

use gtk::prelude::{BuilderExtManual, WidgetExt};

use gtk::traits::ButtonExt;
Comment thread
azdanov marked this conversation as resolved.
use serde::Deserialize;
use subprocess::{Exec, Redirection};
use tracing::{error, info};
Expand Down Expand Up @@ -133,18 +134,21 @@ pub fn launch_installer(message: String) {

let install_btn: gtk::Button = builder.object("install").unwrap();
install_btn.set_sensitive(false);
install_btn.set_label("Checking...");
Comment on lines 135 to +137
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These set_label(...) calls happen inside a std::thread::spawn worker thread. GTK widgets are not thread-safe; updating the button label from a non-main thread can cause crashes or undefined behavior. Route UI updates back to the main loop (e.g., via glib::MainContext/channel, glib::idle_add_local, or glib::timeout_add_local) and only mutate GTK widgets there.

Copilot uses AI. Check for mistakes.

let ui_comp = crate::gui::GUI::new(window_ref.clone());
let checks = [connectivity_check, edition_compat_check, outdated_version_check];
if !checks.iter().all(|x| x(&ui_comp, message.clone())) {
// if any check failed, return
info!("Some ISO check failed!");
install_btn.set_sensitive(true);
install_btn.set_label(&fl!("button-installer-label"));
return;
}

// Spawning child process
info!("ISO checks passed! Starting Installer..");
install_btn.set_label("Launching installer...");
let mut child = Exec::cmd("/usr/local/bin/calamares-online.sh")
Comment on lines +137 to 152
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new button status texts are hard-coded English strings ("Checking...", "Launching installer...") while the default installer label uses fl!(...). To keep the UI fully localizable, add new Fluent keys for these states and use fl!() here as well.

Copilot uses AI. Check for mistakes.
.stdout(Redirection::Pipe)
.stderr(Redirection::Merge)
Expand All @@ -166,6 +170,7 @@ pub fn launch_installer(message: String) {
info!("Installer finished with status: {:?}", status);

install_btn.set_sensitive(true);
install_btn.set_label(&fl!("button-installer-label"));
});
}

Expand Down
Loading