[ghex] gtkhex: Fix copy/paste of HexData between windows



commit 5ef0c9921baddbdde943c84b68bee7095b13f25a
Author: Logan Rathbone <poprocks gmail com>
Date:   Sun Aug 29 22:50:35 2021 -0400

    gtkhex: Fix copy/paste of HexData between windows
    
    Between instances of the gtkhex widget, really. But this issue was
    primarily seen when pasting internally within ghex between multiple
    windows.

 src/gtkhex.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/gtkhex.c b/src/gtkhex.c
index f7f0c823..df4efbbb 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1770,15 +1770,17 @@ static void gtk_hex_real_paste_from_clipboard(GtkHex *gh)
        {
                selection_data = gtk_clipboard_wait_for_contents (
                                klass->clipboard, hex_atom);
-               text = gtk_selection_data_get_data (selection_data);
-               len = gh->priv->clip_buf_len;
        }
        else
        {
                selection_data = gtk_clipboard_wait_for_contents (
                                klass->clipboard, GDK_TARGET_STRING);
+       }
+
+       if (selection_data)
+       {
                text = gtk_selection_data_get_data (selection_data);
-               len = text ? strlen((char *)text) : 0;
+               len = gtk_selection_data_get_length (selection_data);
        }
 
        if (text && len)


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