Skip to content

Commit cf7b21c

Browse files
committed
Make sure GLFW logic happens in main thread
1 parent b19624b commit cf7b21c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### Note:
2+
- This is a smaller release due to the bugfixes it contains, make sure to also read the changelog for [11.0](https://github.com/Willy-JL/F95Checker/releases/tag/11.0)
3+
14
### Added:
25
- Insecure SSL option (by @Willy-JL)
36
- Archive/Unarchive button to more info popup (by @Willy-JL)
@@ -22,6 +25,7 @@
2225
- Detect new 502 error code format (by @Willy-JL)
2326
- Fix latest updates search issues with dots around spaces (by @Willy-JL)
2427
- Fix RPC private network CORS preflight (by @Willy-JL)
28+
- Make sure GLFW logic happens in main thread (by @Willy-JL)
2529

2630
### Removed:
2731
- Removed obsolete DDOS-GUARD bypass, no longer needed and never really worked

modules/gui.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def __init__(self):
336336
self.input_chars: list[int] = []
337337
self.switched_display_mode = False
338338
self.type_label_width: float = None
339+
self.call_soon: list[callable] = []
339340
self.last_selected_game: Game = None
340341
self.prev_filters: list[Filter] = []
341342
self.ghost_columns_enabled_count = 0
@@ -794,12 +795,16 @@ def drop_callback(self, window: glfw._GLFWwindow, items: list[str]):
794795
async_thread.run(api.import_url_shortcut(path))
795796

796797
def hide(self, *_, **__):
798+
if threading.current_thread() is not threading.main_thread():
799+
self.call_soon.append(self.hide)
797800
self.screen_pos = glfw.get_window_pos(self.window)
798801
glfw.hide_window(self.window)
799802
self.hidden = True
800803
self.tray.update_status()
801804

802805
def show(self, *_, **__):
806+
if threading.current_thread() is not threading.main_thread():
807+
self.call_soon.append(self.show)
803808
self.bg_mode_timer = None
804809
self.bg_mode_notifs_timer = None
805810
if not self.hidden:
@@ -856,6 +861,9 @@ def main_loop(self):
856861
self.input_chars, self.poll_chars = self.poll_chars, self.input_chars
857862
self.impl.process_inputs()
858863
imagehelper.apply_textures()
864+
if self.call_soon:
865+
while self.call_soon and (call_soon := self.call_soon.pop(0)):
866+
call_soon()
859867
# Window state handling
860868
size = imgui.io.display_size
861869
mouse_pos = imgui.io.mouse_pos

0 commit comments

Comments
 (0)