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


Commits:
c62477fb by Philipp Hörist at 2025-12-24T13:44:33+01:00
cfix: ChatStack: Fix infinite loop when calling function with idle_add()

- - - - -


2 changed files:

- gajim/common/helpers.py
- gajim/gtk/chat_stack.py


Changes:

=====================================
gajim/common/helpers.py
=====================================
@@ -553,3 +553,11 @@ def warn_about_plain_connection(account: str,
 
 def get_uuid() -> str:
     return str(uuid.uuid4())
+
+
+def idle_add_once(func: Callable[..., Any], *args: Any) -> None:
+    def wrapper():
+        func(*args)
+        return False
+
+    GLib.idle_add(wrapper)


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -25,6 +25,7 @@
 from gajim.common.const import CallType
 from gajim.common.const import Display
 from gajim.common.ged import EventHelper
+from gajim.common.helpers import idle_add_once
 from gajim.common.i18n import _
 from gajim.common.modules.contacts import BareContact
 from gajim.common.modules.contacts import GroupchatContact
@@ -282,7 +283,7 @@ def show_chat(self, account: str, jid: JID) -> None:
 
         app.plugin_manager.extension_point("switch_contact", 
self._current_contact)
 
-        GLib.idle_add(app.window.activate_action, "win.input-focus")
+        idle_add_once(app.window.activate_action, "win.input-focus")
 
     def _on_primary_clipboard_read_text_finished(
         self,



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

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to