[gtk: 1/2] x11: Don't assume valid type




commit dbc4e18bf8ca175262cfb4c28b232b9d5ede3609
Author: Dr. David Alan Gilbert <dave treblig org>
Date:   Sat Jul 30 16:39:18 2022 +0100

    x11: Don't assume valid type
    
    If we get an invalid TARGETS reply, we might not have a valid 'type',
    which ends up as NULL and segs in the g_str_equal.
    
    (This is probably fallout from my fix 506566b6a4c3a9, which I still
    can't reproduce reliably, so the last one just moved the seg a bit
    further along, and we still don't know who is sending a bad TARGETS).
    
    This corresponds to:
    https://bugzilla.redhat.com/show_bug.cgi?id=2062143

 gdk/x11/gdkclipboard-x11.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c
index db2815ed52..f634536b3f 100644
--- a/gdk/x11/gdkclipboard-x11.c
+++ b/gdk/x11/gdkclipboard-x11.c
@@ -358,10 +358,10 @@ gdk_x11_clipboard_request_targets_got_stream (GObject      *source,
       g_error_free (error);
       return;
     }
-  else if (!g_str_equal (type, "ATOM") || format != 32)
+  else if (g_strcmp0 (type, "ATOM") != 0 || format != 32)
     {
       GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or 
format %d != 32\n",
-                                      cb->selection, type, format));
+                                      cb->selection, type ? type : "NULL", format));
       g_input_stream_close (stream, NULL, NULL);
       g_object_unref (stream);
       g_object_unref (cb);


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