[meld/windows-fixes] sourceview: Handle clipboard request failure when pasting



commit 8f4f57ef76a085fc68ce3f0fb6b4ff574a691f95
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Wed Aug 10 11:22:46 2022 +1000

    sourceview: Handle clipboard request failure when pasting
    
    This fixes https://bugzilla.redhat.com/show_bug.cgi?id=2033882

 meld/sourceview.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/meld/sourceview.py b/meld/sourceview.py
index e8646688..63acb9d9 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -230,6 +230,10 @@ class MeldSourceView(GtkSource.View, SourceViewHelperMixin):
         # contain GtkTextTags, by requesting and setting plain text.
 
         def text_received_cb(clipboard, text, *user_data):
+            # On clipboard failure, text will be None
+            if not text:
+                return
+
             # Manual encoding is required here, or the length will be
             # incorrect, and the API requires a UTF-8 bytestring.
             utf8_text = text.encode('utf-8')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]