FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix GTK calls from non-main threads (same SIGSEGV class as #566) by CupOfOwls · Pull Request #625 · StreamController/StreamController · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 5 additions & 1 deletion src/backend/DeckManagement/DeckManager.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ def on_disconnect(self, device_id, device_info):
def remove_controller(self, deck_controller: DeckController) -> None:
self.deck_controller.remove(deck_controller)
if recursive_hasattr(gl, "app.main_win.leftArea.deck_stack"):
gl.app.main_win.leftArea.deck_stack.remove_page(deck_controller)
# remove_controller() is called from non-GTK threads (e.g.
# FlatpakDeckDisconnectThread, udev callbacks); route the GTK call
# through the main loop like add_newly_connected_deck() does for
# add_page().
GLib.idle_add(gl.app.main_win.leftArea.deck_stack.remove_page, deck_controller)
deck_controller.delete()
del deck_controller

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ def show_install_error(self):
threading.Timer(3, self.hide_install_error).start()

def hide_install_error(self):
self.label.set_text(self.install_label)
self.remove_css_class("error")
self.set_sensitive(True)
self.main_button.set_sensitive(True)
# Runs on a threading.Timer thread; GTK calls must go through the
# main loop.
GLib.idle_add(self.label.set_text, self.install_label)
GLib.idle_add(self.remove_css_class, "error")
GLib.idle_add(self.set_sensitive, True)
GLib.idle_add(self.main_button.set_sensitive, True)

def on_remove_click(self, button):
controller = gl.app.main_win.leftArea.deck_stack.get_visible_child().deck_controller
Expand Down
16 changes: 10 additions & 6 deletions src/windows/mainWindow/mainWindow.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,16 @@ def on_remove(self, *args):
return False

def show_info_toast(self, text: str) -> None:
toast = Adw.Toast(
title=text,
timeout=3,
priority=Adw.ToastPriority.NORMAL
)
self.toast_overlay.add_toast(toast)
# Callers include background threads (e.g. update_assets in main.py);
# construct and add the toast on the main loop thread only.
def _add_toast():
toast = Adw.Toast(
title=text,
timeout=3,
priority=Adw.ToastPriority.NORMAL
)
self.toast_overlay.add_toast(toast)
GLib.idle_add(_add_toast)

def get_active_controller(self) -> DeckController:
if not recursive_hasattr(self, "leftArea.deck_stack"): return
Expand Down

Back | FazBrowse Home | New Git URL