Updated modules; fixed thread issues when calling MainApp::update_state

This commit is contained in:
Observer KRypt0n_ 2022-09-02 17:42:20 +02:00
parent 8a62ed5674
commit 79d63a174e
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 26 additions and 23 deletions

@ -1 +1 @@
Subproject commit 50e612c865eef41076ba70d153051b63ff4ecc1e
Subproject commit 2206e00a963a3e1421a9d45d8f71f32a5c9b7acb

@ -1 +1 @@
Subproject commit e87f17c4085ca3617c9673b1139f622b88f8ab20
Subproject commit 9f2247a8200add10b7da738c257bd824832fa3c6

View file

@ -880,17 +880,19 @@ impl App {
self.widgets.status_page.show();
self.widgets.launcher_content.hide();
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
let (send, recv) = std::sync::mpsc::channel();
receiver.attach(None, clone!(@strong self.widgets.status_page as status_page => move |description| {
let this = self.clone();
glib::MainContext::default().invoke(move || {
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
receiver.attach(None, clone!(@strong this.widgets.status_page as status_page => move |description| {
status_page.set_description(Some(&description));
glib::Continue(true)
}));
let this = self.clone();
std::thread::spawn(move || {
match LauncherState::get(move |status| sender.send(status.to_string()).unwrap()) {
Ok(state) => {
@ -910,6 +912,7 @@ impl App {
}
}
});
});
Await::new(move || {
recv.recv().unwrap()