[Qemu-devel] [PATCH] ui: fix dcl unregister

Gerd Hoffmann posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171109073759.5910-1-kraxel@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
There is a newer version of this series
ui/console.c | 1 +
ui/vnc.c     | 2 ++
2 files changed, 3 insertions(+)
[Qemu-devel] [PATCH] ui: fix dcl unregister
Posted by Gerd Hoffmann 6 years, 4 months ago
register checks for dcl->ds being NULL, to avoid registering
the same dcl twice.

Therefore dcl->ds must be cleared on unregister, otherwise
un-registering and re-registering doesn't work.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510809
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/console.c | 1 +
 ui/vnc.c     | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index eca854cbd5..c4c95abed7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1471,6 +1471,7 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl)
         dcl->con->dcls--;
     }
     QLIST_REMOVE(dcl, next);
+    dcl->ds = NULL;
     gui_setup_refresh(ds);
 }
 
diff --git a/ui/vnc.c b/ui/vnc.c
index 9f8d5a1b1f..bd46f11fcc 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3044,6 +3044,7 @@ void vnc_display_init(const char *id)
 {
     VncDisplay *vd;
 
+    fprintf(stderr, "%s: %s\n", __func__, id);
     if (vnc_display_find(id) != NULL) {
         return;
     }
@@ -3982,6 +3983,7 @@ void vnc_display_open(const char *id, Error **errp)
     }
 
     if (con != vd->dcl.con) {
+        fprintf(stderr, "%s: %s\n", __func__, id);
         unregister_displaychangelistener(&vd->dcl);
         vd->dcl.con = con;
         register_displaychangelistener(&vd->dcl);
-- 
2.9.3


Re: [Qemu-devel] [PATCH] ui: fix dcl unregister
Posted by Marc-André Lureau 6 years, 4 months ago
Hi

On Thu, Nov 9, 2017 at 8:37 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> register checks for dcl->ds being NULL, to avoid registering
> the same dcl twice.
>
> Therefore dcl->ds must be cleared on unregister, otherwise
> un-registering and re-registering doesn't work.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510809
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/console.c | 1 +
>  ui/vnc.c     | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/ui/console.c b/ui/console.c
> index eca854cbd5..c4c95abed7 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1471,6 +1471,7 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl)
>          dcl->con->dcls--;
>      }
>      QLIST_REMOVE(dcl, next);
> +    dcl->ds = NULL;
>      gui_setup_refresh(ds);
>  }
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 9f8d5a1b1f..bd46f11fcc 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -3044,6 +3044,7 @@ void vnc_display_init(const char *id)
>  {
>      VncDisplay *vd;
>
> +    fprintf(stderr, "%s: %s\n", __func__, id);
>      if (vnc_display_find(id) != NULL) {
>          return;
>      }
> @@ -3982,6 +3983,7 @@ void vnc_display_open(const char *id, Error **errp)
>      }
>
>      if (con != vd->dcl.con) {
> +        fprintf(stderr, "%s: %s\n", __func__, id);

I suppose the 2 printf are not intentional.

>          unregister_displaychangelistener(&vd->dcl);
>          vd->dcl.con = con;
>          register_displaychangelistener(&vd->dcl);
> --
> 2.9.3
>
>

without the printf,
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>




-- 
Marc-André Lureau