From 96ae3f67a222197ae633225ba4543551126dbd95 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 23 Sep 2025 11:09:57 +0200 Subject: ui/dbus: Clean up dbus_update_gl_cb() error checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From GLib "Rules for use of GError": A GError* must be initialized to NULL before passing its address to a function that can report errors. dbus_update_gl_cb() seemingly violates this rule: it passes &err to qemu_dbus_display1_listener_call_update_dmabuf_finish() and to qemu_dbus_display1_listener_win32_d3d11_call_update_texture2d_finish() without clearing it in between. Harmless, because the first call is guarded by #ifdef CONFIG_GBM, the second by #ifdef WIN32, and the two are mutually exclusive. I think. Clean this up to be obviously correct. Cc: Marc-André Lureau Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Message-ID: <20250923091000.3180122-11-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki --- ui/dbus-listener.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ui/dbus-listener.c') diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 42875b8eed..09d7a319b1 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -221,18 +221,21 @@ static void dbus_update_gl_cb(GObject *source_object, #ifdef CONFIG_GBM success = qemu_dbus_display1_listener_call_update_dmabuf_finish( ddl->proxy, res, &err); + if (!success) { + error_report("Failed to call update: %s", err->message); + } #endif #ifdef WIN32 success = qemu_dbus_display1_listener_win32_d3d11_call_update_texture2d_finish( ddl->d3d11_proxy, res, &err); - d3d_texture2d_acquire0(ddl->d3d_texture, &error_warn); -#endif - if (!success) { error_report("Failed to call update: %s", err->message); } + d3d_texture2d_acquire0(ddl->d3d_texture, &error_warn); +#endif + graphic_hw_gl_block(ddl->dcl.con, false); g_object_unref(ddl); } -- cgit 1.4.1 From f3da25a5571573dfd8b5459b3b4458cd4de38db7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 23 Sep 2025 11:09:58 +0200 Subject: ui/dbus: Consistent handling of texture mutex failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We report d3d_texture2d_acquire0() and d3d_texture2d_release0() failure as error, except in dbus_update_gl_cb(), where we report it as warning. Report it as error there as well. Cc: Marc-André Lureau Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Message-ID: <20250923091000.3180122-12-armbru@redhat.com> Reviewed-by: Akihiko Odaki --- ui/dbus-listener.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'ui/dbus-listener.c') diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 09d7a319b1..52e041edb0 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -214,26 +214,31 @@ static void dbus_update_gl_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - g_autoptr(GError) err = NULL; + g_autoptr(GError) gerr = NULL; +#ifdef WIN32 + Error *err = NULL; +#endif DBusDisplayListener *ddl = user_data; bool success; #ifdef CONFIG_GBM success = qemu_dbus_display1_listener_call_update_dmabuf_finish( - ddl->proxy, res, &err); + ddl->proxy, res, &gerr); if (!success) { - error_report("Failed to call update: %s", err->message); + error_report("Failed to call update: %s", gerr->message); } #endif #ifdef WIN32 success = qemu_dbus_display1_listener_win32_d3d11_call_update_texture2d_finish( - ddl->d3d11_proxy, res, &err); + ddl->d3d11_proxy, res, &gerr); if (!success) { - error_report("Failed to call update: %s", err->message); + error_report("Failed to call update: %s", gerr->message); } - d3d_texture2d_acquire0(ddl->d3d_texture, &error_warn); + if (!d3d_texture2d_acquire0(ddl->d3d_texture, &err)) { + error_report_err(err); + } #endif graphic_hw_gl_block(ddl->dcl.con, false); -- cgit 1.4.1