[PATCH] ui/dbus: fix warning for clients without "Interfaces" property

marcandre.lureau@redhat.com posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260423132329.932887-1-marcandre.lureau@redhat.com
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>
ui/dbus-listener.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] ui/dbus: fix warning for clients without "Interfaces" property
Posted by marcandre.lureau@redhat.com 1 month, 1 week ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The "Interfaces" property is not strictly required. We can just assume
the peer doesn't implement the given interface. Fix warning:
GLib: g_strv_contains: assertion 'strv != NULL' failed

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/dbus-listener.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index 40287d1c687..2e2f6ba4183 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -1010,9 +1010,11 @@ static bool
 dbus_display_listener_implements(DBusDisplayListener *ddl, const char *iface)
 {
     QemuDBusDisplay1Listener *l = QEMU_DBUS_DISPLAY1_LISTENER(ddl->proxy);
+    const char * const *interfaces;
     bool implements;
 
-    implements = g_strv_contains(qemu_dbus_display1_listener_get_interfaces(l), iface);
+    interfaces = qemu_dbus_display1_listener_get_interfaces(l);
+    implements = interfaces && g_strv_contains(interfaces, iface);
     if (!implements) {
         g_debug("Display listener does not implement: `%s`", iface);
     }
-- 
2.53.0


Re: [PATCH] ui/dbus: fix warning for clients without "Interfaces" property
Posted by Philippe Mathieu-Daudé 1 month, 1 week ago
On 23/4/26 15:23, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> The "Interfaces" property is not strictly required. We can just assume
> the peer doesn't implement the given interface. Fix warning:
> GLib: g_strv_contains: assertion 'strv != NULL' failed
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/dbus-listener.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>