Philipp Hörist pushed to branch master at gajim / gajim


Commits:
7e6b655c by lovetox at 2022-05-17T00:00:27+02:00
fix: Chat: Handle race condition when calling focus()

focus() is called asynchron, this means self.msg_textview does
sometimes not exist anymore if shutdown() was called.

Fixes #10552

- - - - -


1 changed file:

- gajim/gtk/controls/chat.py


Changes:

=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -267,6 +267,11 @@ def remove_actions(self) -> None:
             app.window.remove_action(f'{action}{self.control_id}')
 
     def focus(self) -> None:
+        if not hasattr(self, 'msg_textview'):
+            # focus() is called sometimes with GLib.idle_add()
+            # This means there is the possibility that shutdown() was called
+            # before focus is executed.
+            return
         self.msg_textview.grab_focus()
 
     def delegate_action(self, action: str) -> int:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/7e6b655cbb07f96dd9bf77cf4da002b147fb3fb3

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/7e6b655cbb07f96dd9bf77cf4da002b147fb3fb3
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to