Skip to content

Commit

Permalink
component: Schedule progress to run on main loop
Browse files Browse the repository at this point in the history
The download progress is reported from a thread and Gtk is not thread-safe. This fixes issues with the UI breaking when downloading runners/components.
  • Loading branch information
jntesteves committed Jan 6, 2025
1 parent 590cf53 commit 675ad09
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bottles/frontend/widgets/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def async_callback(result, error=False):

return self.update_progress(status=Status.FAILED)

@GtkUtils.run_in_main_loop
def async_func(*args, **kwargs):
return self.update_progress(*args, **kwargs)

self.btn_download.set_visible(False)
self.btn_cancel.set_visible(False) # TODO: unimplemented
self.box_download_status.set_visible(True)
Expand All @@ -102,7 +106,7 @@ def async_callback(result, error=False):
callback=async_callback,
component_type=self.component_type,
component_name=self.name,
func=self.update_progress,
func=async_func,
)

def uninstall(self, widget):
Expand Down

0 comments on commit 675ad09

Please sign in to comment.