From: "Daniel P. Berrangé" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PULL 14/14] ui: add precondition for dpy_get_ui_info()
Date: Thu, 14 Sep 2023 12:52:05 +0100 [thread overview]
Message-ID: <ZQLz5bjfCJ3iOpw3@redhat.com> (raw)
In-Reply-To: <20230912104649.1638640-15-marcandre.lureau@redhat.com>
On Tue, Sep 12, 2023 at 02:46:48PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Ensure that it only get called when dpy_ui_info_supported(). The
> function should always return a result. There should be a non-null
> console or active_console.
Empirically that does not appear to be the case. After this patch,
a no-args QEMU launch immediately aborts:
$ ./build/qemu-system-x86_64
qemu-system-x86_64: ../ui/console.c:818: dpy_get_ui_info: Assertion `dpy_ui_info_supported(con)' failed.
Aborted (core dumped)
This ought to be running the GTK UI for me. Manually ask for
SDL instead and it doesn't crash.
>
> Modify the argument to be const as well.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Albert Esteve <aesteve@redhat.com>
> ---
> include/ui/console.h | 2 +-
> ui/console.c | 4 +++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/ui/console.h b/include/ui/console.h
> index 79e4702912..28882f15a5 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -329,7 +329,7 @@ void update_displaychangelistener(DisplayChangeListener *dcl,
> uint64_t interval);
> void unregister_displaychangelistener(DisplayChangeListener *dcl);
>
> -bool dpy_ui_info_supported(QemuConsole *con);
> +bool dpy_ui_info_supported(const QemuConsole *con);
> const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con);
> int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay);
>
> diff --git a/ui/console.c b/ui/console.c
> index aa1e09462c..4a4f19ed33 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -801,7 +801,7 @@ static void dpy_set_ui_info_timer(void *opaque)
> con->hw_ops->ui_info(con->hw, head, &con->ui_info);
> }
>
> -bool dpy_ui_info_supported(QemuConsole *con)
> +bool dpy_ui_info_supported(const QemuConsole *con)
> {
> if (con == NULL) {
> con = active_console;
> @@ -815,6 +815,8 @@ bool dpy_ui_info_supported(QemuConsole *con)
>
> const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
> {
> + assert(dpy_ui_info_supported(con));
> +
> if (con == NULL) {
> con = active_console;
> }
> --
> 2.41.0
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2023-09-14 11:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 10:46 [PULL 00/14] Ui patches marcandre.lureau
2023-09-12 10:46 ` [PULL 01/14] docs: vhost-user-gpu: add protocol changes for dmabuf modifiers marcandre.lureau
2023-09-12 10:46 ` [PULL 02/14] contrib/vhost-user-gpu: add support for sending " marcandre.lureau
2023-09-12 10:46 ` [PULL 03/14] vhost-user-gpu: support " marcandre.lureau
2023-09-12 10:46 ` [PULL 04/14] vmmouse: replace DPRINTF with tracing marcandre.lureau
2023-09-12 10:46 ` [PULL 05/14] vmmouse: use explicit code marcandre.lureau
2023-09-12 10:46 ` [PULL 06/14] ui/vc: remove kbd_put_keysym() and update function calls marcandre.lureau
2023-09-12 10:46 ` [PULL 07/14] ui/vc: rename kbd_put to qemu_text_console functions marcandre.lureau
2023-09-12 10:46 ` [PULL 08/14] ui/console: remove redundant format field marcandre.lureau
2023-09-12 10:46 ` [PULL 09/14] ui/vc: preliminary QemuTextConsole changes before split marcandre.lureau
2023-09-12 10:46 ` [PULL 10/14] ui/vc: split off the VC part from console.c marcandre.lureau
2023-09-12 10:46 ` [PULL 11/14] ui/console: move DisplaySurface to its own header marcandre.lureau
2023-09-12 10:46 ` [PULL 12/14] virtio-gpu/win32: set the destroy function on load marcandre.lureau
2023-09-12 10:46 ` [PULL 13/14] ui: fix crash when there are no active_console marcandre.lureau
2023-09-12 11:00 ` Michael Tokarev
2023-09-12 11:09 ` Marc-André Lureau
2023-09-12 11:15 ` Daniel P. Berrangé
2023-09-12 11:09 ` Daniel P. Berrangé
2023-09-12 10:46 ` [PULL 14/14] ui: add precondition for dpy_get_ui_info() marcandre.lureau
2023-09-14 11:52 ` Daniel P. Berrangé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZQLz5bjfCJ3iOpw3@redhat.com \
--to=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).