gtk_clipboard_request_targets actually returns n_targets == -1
when targets == NULL instead of zero. This result in failed assertion
within GTK:
qemu: Gtk: gtk_targets_include_text:
assertion 'targets != NULL || n_targets == 0' failed
Extend the check to require non-null targets and positive n_targets.
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <
20260501-clipboard-assert-fix-v1-1-
e549243e4583@gmail.com>
{
QemuClipboardInfo *info = (QemuClipboardInfo *)data;
- if (n_targets) {
+ if (targets && n_targets > 0) {
if (gtk_targets_include_text(targets, n_targets)) {
info->types[QEMU_CLIPBOARD_TYPE_TEXT].available = true;
}