Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
8274bf6e by wurstsalat at 2025-04-11T22:10:46+02:00
fix: Catch exceptions when pasting text from clipboard

Fixes #12258

- - - - -


2 changed files:

- gajim/gtk/chat_stack.py
- gajim/gtk/message_input.py


Changes:

=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -249,8 +249,15 @@ def _on_primary_clipboard_read_text_finished(
         clipboard: Gdk.Clipboard,
         result: Gio.AsyncResult,
     ) -> None:
-        text = clipboard.read_text_finish(result)
+        text = None
+
+        try:
+            text = clipboard.read_text_finish(result)
+        except Exception as e:
+            log.exception("Error while trying to paste text: %s", e)
+
         if text is None:
+            log.info("No text pasted")
             return
 
         # Reset primary clipboard to what it was before switching chats,


=====================================
gajim/gtk/message_input.py
=====================================
@@ -396,7 +396,13 @@ def paste_as_code_block(self) -> None:
     def _on_clipboard_read_text_finished(
         self, clipboard: Gdk.Clipboard, result: Gio.AsyncResult, action_name: 
str
     ) -> None:
-        text = clipboard.read_text_finish(result)
+        text = None
+
+        try:
+            text = clipboard.read_text_finish(result)
+        except Exception as e:
+            log.exception("Error while trying to paste text: %s", e)
+
         if text is None:
             log.info("No text pasted")
             return



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8274bf6edc06b6a88840e8f96aa73de6c7c905a3
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